MDBs are run async. so if they are modifying a document while the document modifs were not saved in the main core thread an
javax.jcr.InvalidItemStateException exception is thrown by JCR
Here is a stack trace of an exception trhown when a document was created => the MDB listener invoked asynchronously =>
the listener try to modify the document that was not yet saved by the main core thread => exception.
(In that case the document was in the creation phase so I think that the MDB tried to change a document that were not yet created in persistent storage.
(10:40:33 AM) Catalin Baican: at org.nuxeo.ecm.platform.filemanager.listener.UploadFileListener.onMessage(UploadFileListener.java:165)
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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:245)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)
at $Proxy164.onMessage(Unknown Source)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:183)
at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:905)
at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
at org.jboss.mq.SpySession.run(SpySession.java:323)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:249)
at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: org.nuxeo.ecm.core.api.DocumentException. message: Failed to save the session
at org.nuxeo.ecm.core.repository.jcr.JCRSession.save(JCRSession.java:149)
at org.nuxeo.ecm.core.api.AbstractSession.save(AbstractSession.java:1313)
... 103 more
Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.jcr.InvalidItemStateException. message: da865211-1da0-46c9-9da8-ee3085e8b599/{}filename: the item cannot be saved because it has been modified externally.
at org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:377)
at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1079)
at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:849)
at org.nuxeo.ecm.core.repository.jcr.JCRSession.save(JCRSession.java:147)
... 104 more