Error initializing repository
jchocholacek May 22, 2009 9:24 AMHi everybody!
I am trying to add DNA repository to the Magnolia CMS. I am following the code in the repository example, but I am getting error when importing cars Graph from XML (config Graph is imported OK). I am using XML files from the repository examples, DNA version is 0.4.
Any idea where the problem could be?
My code:
package org.jboss.labs.magnolia.modules.jcrdownloads; ... public class JcrProviderImpl implements Provider { ... public void init( RepositoryMapping arg0 ) throws RepositoryNotInitializedException { if (repository != null) return; // already started context = new ExecutionContext(); sources = new RepositoryLibrary(context); InMemoryRepositorySource configSource = new InMemoryRepositorySource(); configSource.setName("Configuration"); sources.addSource(configSource); try { String location = "/tmp"; Graph config = Graph.create("Configuration", sources, context); config.createWorkspace().named("default"); config.importXmlFrom(location + "/configRepository.xml").into("/"); repositoryService = new RepositoryService(sources, configSource.getName(), "default", context); repositoryService.getAdministrator().start(); Graph cars = Graph.create("Cars", sources, context); cars.importXmlFrom(location + "/cars.xml").into("/"); // HERE THE ERROR APPEARS Graph aircraft = Graph.create("Aircraft", sources, context); aircraft.importXmlFrom(location + "/aircraft.xml").into("/"); repository = new JcrRepository(context, sources, "Aircraft"); } catch (Exception ex) { log.error("problem loading repository: "+ex.getMessage(), ex); throw new RepositoryNotInitializedException(ex); } } ... }
And the exception:
ERROR org.jboss.labs.magnolia.modules.jcrdownloads.JcrProviderImpl 21.05.2009 14:02:53 -- problem loading repository: null
org.jboss.dna.graph.connector.RepositorySourceException
at org.jboss.dna.graph.Graph.execute(Graph.java:239)
at org.jboss.dna.graph.Graph$5.process(Graph.java:185)
at org.jboss.dna.graph.request.RequestBuilder.verifyWorkspace(RequestBuilder.java:69)
at org.jboss.dna.graph.Graph.useWorkspace(Graph.java:336)
at org.jboss.dna.graph.Graph.getCurrentWorkspace(Graph.java:311)
at org.jboss.dna.graph.Graph.getCurrentWorkspaceName(Graph.java:296)
at org.jboss.dna.graph.Graph$Batch.<init>(Graph.java:2069)
at org.jboss.dna.graph.Graph.batch(Graph.java:2033)
at org.jboss.dna.graph.io.GraphImporter.importXml(GraphImporter.java:167)
at org.jboss.dna.graph.io.GraphImporter.importXml(GraphImporter.java:119)
at org.jboss.dna.graph.Graph$20.into(Graph.java:1979)
at org.jboss.dna.graph.Graph$20.into(Graph.java:1953)
at org.jboss.dna.graph.Graph$20.into(Graph.java:1977)
at org.jboss.labs.magnolia.modules.jcrdownloads.JcrProviderImpl.init(JcrProviderImpl.java:73)
at info.magnolia.cms.beans.config.ContentRepository.loadRepository(ContentRepository.java:348)
...