2015-09-01 2 views
1

Good EveningApache Oak - Importation Failue sur XML avec exception pas un nom valide JCR exception

Je suis nouveau à JCR et Apache Oak (v1.2.3) et semblent avoir un problème d'importer mon formulaire de dépôt Oak XML . (J'ai peuplé le référentiel vers un noeud soutenu par jdbc, mais je ne comprends pas pourquoi je ne peux pas le réimporter dans une nouvelle instance après une exportation vers XML).

Le fichier XML est trop long pour être publié ici, mais si quelqu'un a des idées, ce serait génial. Merci beaucoup

Exemple de code d'importation:

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); 

Exception silencieuse sur Connexion lors de l'importation ..... javax.jcr.nodetype.ConstraintViolationException: Pas un nom JCR valide « JCR: propertyDefinition [2] '

2015-09-01 16: 36: 01,0224 WARN principale xml.DocViewImportHandler: 206 - rencontré le nom décodé illégal 'propertyDefinition [1]' javax.jcr.nodetype.ConstraintViolationException: Pas un nom JCR valide' JCR: propertyDefinition [1] ' at org. apache.jackrabbit.oak.namepath.JcrNameParser.checkName (JcrNameParser.java:210) à org.apache.jackrabbit.oak.jcr.xml.DocViewImportHandler.processName (DocViewImportHandler.java:202) à org.apache.jackrabbit. oak.jcr.xml.DocViewImportHandler.startElement (DocViewImportHandler.java:230) à org.apache.jackrabbit.oak.jcr.xml.ImportHandler.startElement (ImportHandler.java:183) à org.apache.jackrabbit.commons. xml.DefaultContentHandler.startElement (DefaultContentHandler.java:161) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement (AbstractSAXParser.java:506) à l'adresse com.sun.org.apache.xerces. internal.parsers.AbstractXMLDocumentParser.emptyElement (AbstractXMLDocumentParser.java:182) à l'adresse com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.s canStartElement (XMLNSDocumentScannerImpl.java:353) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl $ FragmentContentDriver.next (XMLDocumentFragmentScannerImpl.java:2768) à l'adresse com.sun.org.apache.xerces.internal. impl.XMLDocumentScannerImpl.next (XMLDocumentScannerImpl.java:606) à l'adresse com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next (XMLNSDocumentScannerImpl.java:116) à l'adresse com.sun.org.apache.xerces. internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (XMLDocumentFragmentScannerImpl.java:511) ...

Avec le débogueur je reçois Première exception Suspicion Situation Debugger propertyDefinition_x005b_1_x005d_

XML: propertyDefinition_x005b_1_x005d_

XML Raw: (Désolé, il ne me laisse pas poster tout ça ...

<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" 

Répondre

0


De l'stacktrace, le code semble être trop écrit la nœuds du système (propriétéDefinition_x005b_1_x005d_).
Je vous suggère d'exporter uniquement votre dossier racine personnalisé et de le réimporter, sans toucher aucun des dossiers système (rep: security, jcr: system, oak: index) si cela vous aide.