You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Bear Giles <bg...@coyotesong.com> on 2009/09/10 22:25:56 UTC

problem initializing repository from stream repository.xml

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




Re: problem initializing repository from stream repository.xml

Posted by Bear Giles <bg...@coyotesong.com>.
I've made a little progress.  It's definitely reading the repository.xml 
file and understanding it.  The problem appears to be that the 
workspaces/default/workspace.xml file is empty.  I also noticed that the 
database schema still isn't being created.

Bear

Bear Giles wrote:
> 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
>
>
>