Pivotal Knowledge Base

Follow

CacheXmlException during startup in GemFire 8.1

Applies To

GemFire 8.1

Symptom

When starting a server using a cache XML file (either from GFSH or API), the process throws the following exception:

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

Solution

The workaround for this issue is to manually set the SAXParserFactory used by the JVM when starting the process:

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

Optionally, if you don't need to use external parsers libraries (like Xerces), please remove them from the classpath.

 

Comments

Powered by Zendesk