Pivotal Knowledge Base

关注

Gemfire8.1启动发生CacheXmlException异常

适用于

GemFire 8.1

现象

(通过GFSH或API)使用cache XML文件启动服务时,进程抛出如下异常:

com.gemstone.gemfire.cache.CacheXmlException: While reading Cache XML file:/path/to/folder/cache.xml. While parsing XML, caused by java.io.IOException: Stream closed
at com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlParser.parse(CacheXmlParser.java:241)
at com.gemstone.gemfire.internal.cache.GemFireCacheImpl.loadCacheXml(GemFireCacheImpl.java:4244)
at com.gemstone.gemfire.internal.cache.GemFireCacheImpl.initializeDeclarativeCache(GemFireCacheImpl.java:1174)
at com.gemstone.gemfire.internal.cache.GemFireCacheImpl.init(GemFireCacheImpl.java:1018)
at com.gemstone.gemfire.internal.cache.GemFireCacheImpl.create(GemFireCacheImpl.java:682)
at com.gemstone.gemfire.cache.CacheFactory.create(CacheFactory.java:182)
at com.gemstone.gemfire.cache.CacheFactory.create(CacheFactory.java:229)
at com.gemstone.gemfire.distributed.ServerLauncher.startWithGemFireApi(ServerLauncher.java:794)
at com.gemstone.gemfire.distributed.ServerLauncher.start(ServerLauncher.java:696)
at com.gemstone.gemfire.distributed.ServerLauncher.run(ServerLauncher.java:626)
at com.gemstone.gemfire.distributed.ServerLauncher.main(ServerLauncher.java:200)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162)
at java.io.BufferedInputStream.reset(BufferedInputStream.java:435)
at com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlParser.parse(CacheXmlParser.java:200)
... 10 more

解决方案

针对该问题可选择的替代办法是在启动进程时,手动设定JVM使用的SAXParserFactory:

--J=-Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl

或者,如果您不需要使用外部的解析库(如Xerces),请将其移除出CLASSPATH。

 

评论

由 Zendesk 提供技术支持