【解决】Caused by: org.apache.tiles.definition.DefinitionsFactoryException: I/O Error reading definition

使用springmvc tiles模板框架的时候出现如下错误

Caused by: org.apache.tiles.definition.DefinitionsFactoryException: I/O Error reading definitions.     at org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(DigesterDefinitionsReader.java:273)     at org.apache.tiles.definition.UrlDefinitionsFactory.readDefinitions(UrlDefinitionsFactory.java:286)     at org.apache.tiles.definition.UrlDefinitionsFactory.init(UrlDefinitionsFactory.java:130)     at org.apache.tiles.impl.BasicTilesContainer.initializeDefinitionsFactory(BasicTilesContainer.java:406)     at org.apache.tiles.impl.BasicTilesContainer.init(BasicTilesContainer.java:130)     at org.apache.tiles.factory.TilesContainerFactory.initializeContainer(TilesContainerFactory.java:232)     at org.apache.tiles.factory.TilesContainerFactory.createTilesContainer(TilesContainerFactory.java:198)     at org.apache.tiles.factory.TilesContainerFactory.createContainer(TilesContainerFactory.java:163)     at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:90)     at org.apache.struts2.tiles.StrutsTilesListener.createContainer(StrutsTilesListener.java:68)     at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)     ... 15 more Caused by: java.net.SocketException: Connection reset     at java.net.SocketInputStream.read(Unknown Source)     at java.io.BufferedInputStream.fill(Unknown Source)     at java.io.BufferedInputStream.read1(Unknown Source)     at java.io.BufferedInputStream.read(Unknown Source)     at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)     at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)     at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)     at org.apache.commons.digester.Digester.createInputSourceFromURL(Digester.java:2072)     at org.apache.commons.digester.Digester.resolveEntity(Digester.java:1725)     at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(Unknown Source)     at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(Unknown Source)     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(Unknown Source)     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(Unknown Source)     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)     at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)     at org.apache.commons.digester.Digester.parse(Digester.java:1887)     at org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(DigesterDefinitionsReader.java:267)

解决方法修改tilesContext.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
       "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">

把上面的替换成下面的,原来使用的是tiles 2.1 dtd文件修改成3.0问题解决

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
       "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">

第二种方法把.dtd文件下载下来 放到tilesContext.xml同级目录 不需要网上验证语法规则,

下载地址 http://tiles.apache.org/dtds/tiles-config_3_0.dtd,tilesContext.xml头文件内容如下

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
       "tiles-config_3_0.dtd">

如果apache访问不了 请到我的网盘中下载,http://pan.baidu.com/s/1mgBNSPM

tiles-config_3_0.dtd

来源://作者:/更新时间:2014-06-18
相关文章
评论:
验证码:
匿名评论:

最新文章

文章排行