Good Evening
I'm new to JCR and Apache Oak (v1.2.3) and seem to have a problem importing my Oak repository form XML. ( I populated the repository to a jdbc backed node, but fail to understand why I can't re-import it to a new instance following an export to XML).
The XML file is too long to post here but if anyone has any ideas that would be great. Many Thanks
Example Import Code:
try {
String tesExampleXML = FileUtils.readFileToString(new File("/testRepository.xml"));
Repository repo = new Jcr(new Oak()).createRepository();
Session sesh = repo.login(new SimpleCredentials("admin", "admin".toCharArray()));
sesh.importXML("/",new StringBufferInputStream(tesExampleXML),0);
Node root = sesh.getRootNode();
NodeIterator it = root.getNodes();
while (it.hasNext()){
Node n = it.nextNode();
System.out.println(n.getName());
}
//By this point not all of the nodes in root were printed
assertTrue(root != null);
Silent Exception On Log when importing..... javax.jcr.nodetype.ConstraintViolationException: Not a valid JCR name 'jcr:propertyDefinition[2]'
2015-09-01 16:36:01.0224 WARN main xml.DocViewImportHandler:206 - encountered illegal decoded name 'propertyDefinition[1]' javax.jcr.nodetype.ConstraintViolationException: Not a valid JCR name 'jcr:propertyDefinition[1]' at org.apache.jackrabbit.oak.namepath.JcrNameParser.checkName(JcrNameParser.java:210) at org.apache.jackrabbit.oak.jcr.xml.DocViewImportHandler.processName(DocViewImportHandler.java:202) at org.apache.jackrabbit.oak.jcr.xml.DocViewImportHandler.startElement(DocViewImportHandler.java:230) at org.apache.jackrabbit.oak.jcr.xml.ImportHandler.startElement(ImportHandler.java:183) at org.apache.jackrabbit.commons.xml.DefaultContentHandler.startElement(DefaultContentHandler.java:161) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:353) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2768) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) ...
With the debugger I get First Suspected Exception Location In Debugger propertyDefinition_x005b_1_x005d_
XML: propertyDefinition_x005b_1_x005d_
Raw XML:(Sorry it won't let me post the whole thing...
<jcr:root jcr:primaryType="rep:root" xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0" xmlns:rep="internal"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
<hello jcr:primaryType="nt:unstructured" count="2" />
<jcr:system jcr:primaryType="rep:system">
<jcr:activities jcr:primaryType="rep:Activities" />
<jcr:nodeTypes jcr:primaryType="rep:nodeTypes">
<mix:atomicCounter jcr:primaryType="rep:NodeType"
jcr:hasOrderableChildNodes="false" jcr:isAbstract="false"
jcr:isMixin="true" jcr:isQueryable="true" jcr:nodeTypeName="mix:atomicCounter"
rep:hasProtectedResidualChildNodes="false"
rep:hasProtectedResidualProperties="false">
<jcr:propertyDefinition_x005b_1_x005d_
jcr:primaryType="nt:propertyDefinition" jcr:autoCreated="true"
jcr:isFullTextSearchable="true" jcr:isQueryOrderable="true"
jcr:mandatory="false" jcr:multiple="false" jcr:name="oak:counter"
jcr:onParentVersion="COPY" jcr:protected="true" jcr:requiredType="LONG" />
<rep:namedPropertyDefinitions
jcr:primaryType="rep:NamedPropertyDefinitions">
<oak:counter jcr:primaryType="rep:PropertyDefinitions">
<LONG jcr:primaryType="rep:PropertyDefinition"
jcr:autoCreated="true" jcr:isFullTextSearchable="true"
jcr:isQueryOrderable="true" jcr:mandatory="false" jcr:multiple="false"
jcr:name="oak:counter" jcr:onParentVersion="COPY" jcr:protected="true"
jcr:requiredType="LONG" rep:declaringNodeType="mix:atomicCounter" />
</oak:counter>
</rep:namedPropertyDefinitions>
</mix:atomicCounter>
<mix:created jcr:primaryType="rep:NodeType"
jcr:hasOrderableChildNodes="false" jcr:isAbstract="false"
jcr:isMixin="true" jcr:isQueryable="true" jcr:nodeTypeName="mix:created"
rep:hasProtectedResidualChildNodes="false"
rep:hasProtectedResidualProperties="false">
<jcr:propertyDefinition_x005b_1_x005d_
jcr:primaryType="nt:propertyDefinition" jcr:autoCreated="true"
jcr:isFullTextSearchable="true" jcr:isQueryOrderable="true"
jcr:mandatory="false" jcr:multiple="false" jcr:name="jcr:created"
jcr:onParentVersion="COPY" jcr:protected="true" jcr:requiredType="DATE" />
<jcr:propertyDefinition_x005b_2_x005d_
jcr:primaryType="nt:propertyDefinition" jcr:autoCreated="true"
jcr:isFullTextSearchable="true" jcr:isQueryOrderable="true"
jcr:mandatory="false" jcr:multiple="false" jcr:name="jcr:createdBy"
jcr:onParentVersion="COPY" jcr:protected="true" jcr:requiredType="STRING" />
<rep:namedPropertyDefinitions
jcr:primaryType="rep:NamedPropertyDefinitions">
<jcr:created jcr:primaryType="rep:PropertyDefinitions">
<DATE jcr:primaryType="rep:PropertyDefinition"
jcr:autoCreated="true" jcr:isFullTextSearchable="true"
jcr:isQueryOrderable="true" jcr:mandatory="false" jcr:multiple="false"
jcr:name="jcr:created" jcr:onParentVersion="COPY" jcr:protected="true"
jcr:requiredType="DATE" rep:declaringNodeType="mix:created" />
</jcr:created>
<jcr:createdBy jcr:primaryType="rep:PropertyDefinitions">
<STRING jcr:primaryType="rep:PropertyDefinition"
jcr:autoCreated="true" jcr:isFullTextSearchable="true"
jcr:isQueryOrderable="true" jcr:mandatory="false" jcr:multiple="false"
jcr:name="jcr:createdBy" jcr:onParentVersion="COPY"
jcr:protected="true" jcr:requiredType="STRING"
rep:declaringNodeType="mix:created" />
</jcr:createdBy>
</rep:namedPropertyDefinitions>
</mix:created>
<mix:etag jcr:primaryType="rep:NodeType"
jcr:hasOrderableChildNodes="false" jcr:isAbstract="false"
jcr:isMixin="true" jcr:isQueryable="true" jcr:nodeTypeName="mix:etag"
rep:hasProtectedResidualChildNodes="false"
rep:hasProtectedResidualProperties="false">
<jcr:propertyDefinition_x005b_1_x005d_
jcr:primaryType="nt:propertyDefinition" jcr:autoCreated="true"
jcr:isFullTextSearchable="true" jcr:isQueryOrderable="true"
jcr:mandatory="false" jcr:multiple="false" jcr:name="jcr:etag"
jcr:onParentVersion="COPY" jcr:protected="true" jcr:requiredType="STRING" />
<rep:namedPropertyDefinitions
jcr:primaryType="rep:NamedPropertyDefinitions">
<jcr:etag jcr:primaryType="rep:PropertyDefinitions">
<STRING jcr:primaryType="rep:PropertyDefinition"
jcr:autoCreated="true" jcr:isFullTextSearchable="true"
jcr:isQueryOrderable="true" jcr:mandatory="false" jcr:multiple="false"
jcr:name="jcr:etag" jcr:onParentVersion="COPY" jcr:protected="true"
jcr:requiredType="STRING" rep:declaringNodeType="mix:etag" />
</jcr:etag>
</rep:namedPropertyDefinitions>
</mix:etag>
<mix:language jcr:primaryType="rep:NodeType"
jcr:hasOrderableChildNodes="false" jcr:isAbstract="false"
jcr:isMixin="true" jcr:isQueryable="true" jcr:nodeTypeName="mix:language"
rep:hasProtectedResidualChildNodes="false"
rep:hasProtectedResidualProperties="false">
<jcr:propertyDefinition_x005b_1_x005d_
jcr:primaryType="nt:propertyDefinition" jcr:autoCreated="false"
jcr:isFullTextSearchable="true" jcr:isQueryOrderable="true"
jcr:mandatory="false" jcr:multiple="false" jcr:name="jcr:language"
jcr:onParentVersion="COPY" jcr:protected="false" jcr:requiredType="STRING" />
<rep:namedPropertyDefinitions
jcr:primaryType="rep:NamedPropertyDefinitions">
<jcr:language jcr:primaryType="rep:PropertyDefinitions">
<STRING jcr:primaryType="rep:PropertyDefinition"
jcr:autoCreated="false"