jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Spacejunkie4e...@gmx.de
Subject Problem with versioning: Getting unversioned childNodes from a versionable frozen node results in ItemNotFoundExceptions
Date Wed, 10 Jun 2009 15:42:20 GMT
Hello everybody,

I have a problem when retrieving childnodes from a frozen node. When I first add the childnodes
and then make a checkin with the parent node, everything is fine. When I then checkout the
parent node, change something on the childnodes 
and checkin the parent again, I get ItemNotFoundExceptions when trying to read something (propertys
or childnodes) from the second version of the frozen parent node. 

Caused by: javax.jcr.ItemNotFoundException: failed to build path of 72530f73-9d5d-4a2b-832a-0109320b95dc:
0f1ecab6-c3a8-436a-b66e-648b29e661ad has no child entry for 72530f73-9d5d-4a2b-832a-0109320b95dc
                at org.apache.jackrabbit.core.HierarchyManagerImpl.buildPath(HierarchyManagerImpl.java:289)
                at org.apache.jackrabbit.core.CachingHierarchyManager.buildPath(CachingHierarchyManager.java:195)
                at org.apache.jackrabbit.core.HierarchyManagerImpl.buildPath(HierarchyManagerImpl.java:278)
                at org.apache.jackrabbit.core.CachingHierarchyManager.buildPath(CachingHierarchyManager.java:195)
                at org.apache.jackrabbit.core.HierarchyManagerImpl.getPath(HierarchyManagerImpl.java:393)
                at org.apache.jackrabbit.core.CachingHierarchyManager.getPath(CachingHierarchyManager.java:229)
                at org.apache.jackrabbit.core.ItemImpl.getPrimaryPath(ItemImpl.java:213)
                at org.apache.jackrabbit.core.NodeImpl.getPrimaryPath(NodeImpl.java:3240)
                at org.apache.jackrabbit.core.ItemImpl.getPath(ItemImpl.java:1271)


This is basically the main code I want to run:
                        
                        Node elementNode = session.getNodeByUUID(entity.getUuid());
                        
                        if (elementNode == null) {
                             return null;      
                        }

                      VersionHistory history = elementNode.getVersionHistory();
                      VersionIterator it = history.getAllVersions();
                      //Skip RootVersion
                      it.skip(1);
                      while(it.hasNext()) {
                        Version version = it.nextVersion();

                        NodeIterator nodeIterator = version.getNodes("jcr:frozenNode");

                      
                        ContentMapper contentMapper = cmf.createInstance(qType);
                        
                        while (nodeIterator.hasNext()) {
                              Node node = nodeIterator.nextNode();
                              jcrElements.add(contentMapper.map(node, ContentLoading.NONE));
                        }   
                      }

The ContentMappers make something similiar to the OCM Framework – they convert jcrnodes
to business entities. When I try to access child informations in the last expression, the
exception above is thrown. This is only the case with the second version of the elementNode
(that is after first checkingout the version after the rootVersionNode).

The code for saving the second version is the following:

                node.checkout();
                saveAttributes(node, businessEntity);
                mergeAssociations(session, node, businesEntity);
                node.save();
                node.checkin();

Any advices?

Best Regards

Stephan Eichmann

-- 
GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und Telefonanschluss
für nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

Mime
View raw message