I've been using RMI and temporary repositories for a while but am now
getting a weird problem when trying to start one within my application.
The code is
public RepositoryFactory() throws IOException {
InputStream is = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(CONFIGURATION_FILE);
File home = getRepositoryLocation();
if (is == null) {
throw new IOException("unable to open configuration stream!");
}
try {
config = RepositoryConfig.create(new InputSource(is),
home.getAbsolutePath());
} catch (ConfigurationException e) {
// FIXME handle this exception better.
throw new RuntimeException(e);
}
}
and I've verified that the InputStream contains the expected content.
'home' is actually System.property("java.io.temp")+"/jcr-repository".
When the app starts I get:
Caused by: org.apache.jackrabbit.core.config.ConfigurationException:
Configuration file syntax error. (Line: -1 Column: -1): Premature end of
file.: Premature end of file.
at
org.apache.jackrabbit.core.config.ConfigurationParser.parseXML(ConfigurationParser.java:252)
at
org.apache.jackrabbit.core.config.ConfigurationParser.parseXML(ConfigurationParser.java:221)
at
org.apache.jackrabbit.core.config.RepositoryConfigurationParser.parseWorkspaceConfig(RepositoryConfigurationParser.java:410)
at
org.apache.jackrabbit.core.config.RepositoryConfig.loadWorkspaceConfig(RepositoryConfig.java:379)
at
org.apache.jackrabbit.core.config.RepositoryConfig.init(RepositoryConfig.java:334)
at
org.apache.jackrabbit.core.config.RepositoryConfig.create(RepositoryConfig.java:150)
at
gov.usda.aphis.vsps.dao.jcr.RepositoryFactory.<init>(RepositoryFactory.java:51)
... 47 more
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at
org.apache.jackrabbit.core.config.ConfigurationParser.parseXML(ConfigurationParser.java:246)
... 53 more
Any ideas?
Bear