jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quipere <jquip...@hotmail.com>
Subject Re: ItemNotFoundException while switching between workspaces
Date Mon, 28 Aug 2006 08:32:41 GMT

Didn't anybody encounter this problem? Think it might be a bug.



quipere wrote:
> 
> Hi, I am getting a strange exception while I am switching between
> workspaces.
> 
> I am processing a list of xml files and import them in a repository. My
> repository is deployed as model3 (server) on tomcat 5.5.x, and I am using
> the derbypersistence manager.
> When I proces the xmlfiles, I first check whether the file already exists
> in the repository, if so I am importing this file in a different
> workspace.
> 
> After the files have been imported I am calling a method which gets all
> existing nodes. The problem appears when I have a Arraylist of files which
> contains both existing as new files. So when I am saving nodes in two
> different workspaces. When I call the method which gets all nodes
> everything goes fine (gets it from the cache), only when I restart tomcat
> (repository shutdown and startup) and call the get method afterwards I am
> getting an ItemNotFoundException. This only happens with the
> derbypersistencemanager, when I switch to the Filesystempersistencemanager
> no errors occur.
> It seems like the derbypersistencemanager mixes the references to nodes
> between workspaces. The cache stores them in the right way, so I am only
> getting the exception after a repository (tomcat) restart.
> 
> This is my code:
> 
>  public List importBundle(List files) throws PersistencyException { 
>                 Session sessionW1 = null; 
>                 Session sessionW2 = null; 
>                 List lockTokens = new ArrayList(); 
>                 try { 
>                         sessionW1 = getRepositorySession(WORKSPACE_1); 
>                         sessionW2 = getRepositorySession(WORKSPACE_2); 
>                         Iterator it = files.iterator(); 
>                         while (it.hasNext()) { 
>                                 ImportFile file = (ImportFile) it.next(); 
>                                 importFileAsXMLDocument(file, sessionW1,
> sessionW2); 
>                         }                         
>                         sessionW1.save(); 
>                         sessionW2.save(); 
>                         return lockTokens; 
>                 } catch (Exception e) { 
>                         e.printStackTrace(); 
>                 } finally { 
>                         if (sessionW1 != null) { 
>                                 sessionW1.logout(); 
>                         } 
>                         if (sessionW2 != null) { 
>                                 sessionW2.logout(); 
>                         } 
>                 } 
>         } 
>         
>         public String importFileAsXMLDocument(UPloadFile file, Session
> sessionW1, Session sessionW2) throws PersistencyException { 
>                 boolean recordExists = false; 
>                 Lock lock = null; 
>                 String lockToken = null; 
>                 try { 
>                         QueryResult result =
> sessionW1.getWorkspace().getQueryManager().createQuery("somequerytofindexistingfile",
> Query.XPATH).execute(); 
>                         NodeIterator nodes = result.getNodes(); 
>                         if (nodes.getSize() > 0) { 
>                                 recordExists = true; 
>                                 Node node = nodes.nextNode(); 
>                                 lock = node.lock(true, false); 
> 
>                         }                         
>                         if (recordExists) { 
>                                 sessionW1.importXML("/",
> file.getInputStream(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW); 
>                         } else { 
>                                 sessionW2.importXML("/",
> file.getInputSTream(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW); 
>                         } 
>                         if (lock != null) { 
>                                 lockToken = lock.getLockToken(); 
>                         } 
>                         return lockToken; 
>                 } catch (Exception e) { 
>                         e.printStackTrace(); 
>                 }   
>         }
> 
> The get method:
> 
> 		public List getRecords() {
> 			List records = new ArrayList();
> 			session = getRepositorySession(WORKSPACE_MAIN); 
>                         String executableQuery = "/*"; 
>                         
>                         Query repositoryQuery =
> session.getWorkspace().getQueryManager() 
>                                         .createQuery(executableQuery,
> Query.XPATH); 
>                         QueryResult result = repositoryQuery.execute(); 
>                         NodeIterator it = result.getNodes(); 
>                         while (it.hasNext()) { 
>                                 Node node = it.nextNode(); 
>                                 records.add(node); 
>                         } 
>                         return records; 
> 		}
> 
> The exception is thrown at it.hasnext(). During debugging I see the
> nodeiterator contains all nodes I would expect only hasnext throws this
> exception:
> 
> 23.08.2006 17:44:08 *ERROR* DocOrderNodeIteratorImpl: Exception while
> sorting nodes in document order: javax.jcr.ItemNotFoundException: failed
> to build path of 06758d0b-1797-462b-8793-78ece4adfe06:
> cafebabe-cafe-babe-cafe-babecafebabe has no child entry for
> 06758d0b-1797-462b-8793-78ece4adfe06 (DocOrderNodeIteratorImpl.java, line
> 244) 
> javax.jcr.ItemNotFoundException: failed to build path of
> 06758d0b-1797-462b-8793-78ece4adfe06: cafebabe-cafe-babe-cafe-babecafebabe
> has no child entry for 06758d0b-1797-462b-8793-78ece4adfe06 
>         at
> org.apache.jackrabbit.core.HierarchyManagerImpl.buildPath(HierarchyManagerImpl.java:307)

>         at
> org.apache.jackrabbit.core.CachingHierarchyManager.buildPath(CachingHierarchyManager.java:158)

>         at
> org.apache.jackrabbit.core.HierarchyManagerImpl.buildPath(HierarchyManagerImpl.java:296)

>         at
> org.apache.jackrabbit.core.CachingHierarchyManager.buildPath(CachingHierarchyManager.java:158)

>         at
> org.apache.jackrabbit.core.HierarchyManagerImpl.getPath(HierarchyManagerImpl.java:356)

>         at
> org.apache.jackrabbit.core.CachingHierarchyManager.getPath(CachingHierarchyManager.java:220)

>         at
> org.apache.jackrabbit.core.ItemImpl.getPrimaryPath(ItemImpl.java:305) 
>         at
> org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl$1.compare(DocOrderNodeIteratorImpl.java:202)

>         at java.util.Arrays.mergeSort(Arrays.java:1284) 
>         at java.util.Arrays.sort(Arrays.java:1223) 
>         at
> org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.initOrderedIterator(DocOrderNodeIteratorImpl.java:179)

>         at
> org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.hasNext(DocOrderNodeIteratorImpl.java:135)

>         at
> com.assembleon.plm.repository.access.impl.RepositoryDAOImpl.getAllRecordsWithType(RepositoryDAOImpl.java:733)

>         at
> com.assembleon.plm.services.impl.RepositoryServiceImpl.getRecordsWithType(RepositoryServiceImpl.java:170)

>         at
> com.assembleon.plm.mbeans.DownloadRecordMBean.getRecords(DownloadRecordMBean.java:113)

>         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
> org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)

>         at
> org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82) 
>         at
> com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167) 
>         at
> com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151) 
>         at
> com.sun.faces.el.impl.UnaryOperatorExpression.evaluate(UnaryOperatorExpression.java:167)

>         at
> com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)

>         at
> com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173) 
>         at
> com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154) 
>         at
> javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1076) 
>         at
> org.apache.myfaces.component.html.ext.HtmlOutputText.isRendered(HtmlOutputText.java:85)

>         at
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:532) 
>         at
> javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:495) 
>         at
> javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:363) 
>         at
> org.apache.jsp.jsp.downloadRecord_jsp._jspx_meth_t_outputText_4(downloadRecord_jsp.java:1138)

>         at
> org.apache.jsp.jsp.downloadRecord_jsp._jspx_meth_h_form_0(downloadRecord_jsp.java:245)

>         at
> org.apache.jsp.jsp.downloadRecord_jsp._jspx_meth_f_view_0(downloadRecord_jsp.java:150)

>         at
> org.apache.jsp.jsp.downloadRecord_jsp._jspService(downloadRecord_jsp.java:111) 
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) 
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
>         at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) 
>         at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) 
>         at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) 
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

>         at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)

>         at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)

>         at
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)

>         at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)

>         at
> com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322) 
>         at
> com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130) 
>         at
> com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87) 
>         at
> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200) 
>         at
> com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117) 
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138) 
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

>         at
> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)

>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) 
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) 
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) 
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) 
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) 
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) 
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) 
>         at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)

>         at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) 
>         at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

>         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) 
>         at java.lang.Thread.run(Thread.java:595)
> 

-- 
View this message in context: http://www.nabble.com/ItemNotFoundException-while-switching-between-workspaces-tf2154626.html#a6016346
Sent from the Jackrabbit - Dev forum at Nabble.com.


Mime
View raw message