3
votes

I have already send the same message to jackrabbit user list, but nobody reply me.

I would like to update a node and his childs with Jackrabbit 2.4.3 throw jackrabbit-jcr2dav. ( like a merge : updating, creating or removing nodes ).

But when I update a property already existing in the repository I have an ERROR in the log, and nothing is saved. It's not an exception, only an error.

[ERROR] org.apache.jackrabbit.jcr2spi.hierarchy.ChildNodeEntriesImpl:176 - ChildInfo iterator contains multiple entries with the same name|index or uniqueID -> ignore ChildNodeInfo.

my code :

Repository repository = JcrUtils.getRepository(jcrUrl); Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));

    try { 
        String user = session.getUserID(); 
        String repositoryname = repository.getDescriptor(Repository.REP_NAME_DESC); 
        LOGGER.debug( "Logged in as " + user + " to a " + repositoryname + " repository.");


        // Retrieve content 
        StringBuilder expression = new StringBuilder();
        expression.append("SELECT * FROM [nt:unstructured] AS mynode ");
        expression.append("WHERE id = "+ mynode.getId() +" " );

        QueryManager queryMgr = session.getWorkspace().getQueryManager();
        Query query = queryMgr.createQuery(expression.toString(),Query.JCR_SQL2);
        QueryResult result = query.execute();
        RowIterator rowIterator = result.getRows();

        if (rowIterator.hasNext() ) {
            Node node = rowIterator.nextRow().getNode();

            // Store metadata content 
            node.setProperty("description", mynode.getDescription());
            node.setProperty("keywords", mynode.getKeywords());
            node.setProperty("title", mynode.getTitle());   // ERROR IN THE LOG AT THIS LINE because description and keywords doesn't exist, but title already exist.
            node.setProperty("resume", mynode.getResume()); 

            [... updating childs node here ]

            session.save(); 

        }
    } catch ( RepositoryException e) {
        LOGGER.error("Error getting data", e);
        throw e;
    } finally { 
        session.logout(); 
    }
    return book;
} 

Is someone already try to update a node property ?

Thanks

1
The error is not directly obvious. I would test the following things: Occurs the error on the first node? Occurs this error when you select the node with another querytype. Maybe the comment on this method gives you further information: grepcode.com/file/repo1.maven.org/maven2/org.apache.jackrabbit/…dataverse

1 Answers

0
votes

Finally, I have confirmation that two nodes under the same parent should note have the same name. That's why I have this error. Without having the same name, my code is working.