I am trying to use the system view to export/import the repository contents.

Export:
session2.exportSystemView(session.getRootNode().getPath(), outputStream, false, false);

When I import like this:
session.importXML("/", inputStream, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);

I get the following exception:

java.lang.Exception: javax.jcr.nodetype.ConstraintViolationException: /jcr:root/jcr:system/jcr:versionStorage: cannot add a child to a protected node
        at ImportControllerImpl.import(ImportControllerImpl.java:30)
        at ImportControllerTest.testImport(ImportControllerTest.java:12)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: javax.jcr.nodetype.ConstraintViolationException: /jcr:root/jcr:system/jcr:versionStorage: cannot add a child to a protected node at org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:779)
        at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1510)
at org.apache.jackrabbit.core.xml.SessionImporter.createNode(SessionImporter.java:124) at org.apache.jackrabbit.core.xml.SessionImporter.startNode(SessionImporter.java:242) at org.apache.jackrabbit.core.xml.SysViewImportHandler.processNode(SysViewImportHandler.java:82) at org.apache.jackrabbit.core.xml.SysViewImportHandler.startElement(SysViewImportHandler.java:137) at org.apache.jackrabbit.core.xml.ImportHandler.startElement(ImportHandler.java:234)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown 
Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at 
org.apache.jackrabbit.core.SessionImpl.importXML(SessionImpl.java:1020)
        at ImportControllerImpl.import(ImportControllerImpl.java:27)
        ... 16 more

Manuel

Reply via email to