0 Replies Latest reply on Nov 6, 2006 12:40 PM by Camilo Lara

    ObjectNotFoundException: No such entity! Transaction Problem

    Camilo Lara Newbie

      Hi,

      I got a javax.ejb.ObjectNotFoundException: exception trying to get a CMP Bean Data written by a MessageDrivenBean:

      I am doing the following steps:

      MDB1 read some information from a topic
      MDB1 call the create method from a CMP Bean for saving the information in the DB
      MDB1 send a message to a queue with the primary key of the CMP Bean written before to the DB
      MDB2 read the primary key from the queue and starts a Thread parameterized with the primary key
      The Thread tries to get the CMP Bean data using the findByPrimaryKey method.

      I traced my Beans and I can recognize that the CMP Bean Data is on the DB ant the create method is finished.

      I suppose the problem is that the CMP.create transaction isn?t committed before I try to read the DB record using the CMP.findByPrimaryKey because it works if I insert a wait for 1000 ms and retry to execute the findByPrimaryKey method

      Now the question:

      How can I be sure that the create transaction is committed before I read it again?

      I am running Jboss 4.05, Oracle XE 10 and Java 1.4.2 all on the same server (ubuntu 2.6.15-26-server)

      here the completed exception:

      19:40:38,778 ERROR [STDERR] javax.ejb.ObjectNotFoundException: No such entity!
      19:40:38,779 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:64)
      19:40:38,779 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:604)
      19:40:38,779 ERROR [STDERR] at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:315)
      19:40:38,779 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:236)
      19:40:38,779 ERROR [STDERR] at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1103)
      19:40:38,780 ERROR [STDERR] at org.jboss.ejb.EntityContainer.find(EntityContainer.java:721)
      19:40:38,780 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      19:40:38,780 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      19:40:38,780 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      19:40:38,780 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
      19:40:38,780 ERROR [STDERR] at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      19:40:38,781 ERROR [STDERR] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1130)
      19:40:38,781 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
      19:40:38,781 ERROR [STDERR] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:203)
      19:40:38,781 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:189)
      19:40:38,781 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
      19:40:38,781 ERROR [STDERR] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:134)
      19:40:38,781 ERROR [STDERR] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:76)
      19:40:38,781 ERROR [STDERR] at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:43)
      19:40:38,782 ERROR [STDERR] at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
      19:40:38,782 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
      19:40:38,782 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      19:40:38,782 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
      19:40:38,782 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145)
      19:40:38,782 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
      19:40:38,783 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
      19:40:38,783 ERROR [STDERR] at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:514)
      19:40:38,783 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:975)
      19:40:38,783 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
      19:40:38,783 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      19:40:38,783 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
      19:40:38,783 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      19:40:38,783 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      19:40:38,784 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      19:40:38,784 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      19:40:38,784 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      19:40:38,784 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
      19:40:38,784 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
      19:40:38,784 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:206)
      19:40:38,784 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:192)
      19:40:38,785 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
      19:40:38,785 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
      19:40:38,785 ERROR [STDERR] at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184)
      19:40:38,785 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
      19:40:38,785 ERROR [STDERR] at $Proxy136.findByPrimaryKey(Unknown Source)
      19:40:38,785 ERROR [STDERR] at edu.leipzig.taskman.TaskCache.getTask(TaskCache.java:287)
      19:40:38,785 ERROR [STDERR] at edu.leipzig.taskman.ClientUpdate.addOpenTask(ClientUpdate.java:284)
      19:40:38,786 ERROR [STDERR] at edu.leipzig.taskman.ClientManager.taskCreated(ClientManager.java:48)
      19:40:38,786 ERROR [STDERR] at edu.leipzig.taskman.ejb.NewTask_PropagatingBean.handleClientTask(NewTask_PropagatingBean.java:254)
      19:40:38,786 ERROR [STDERR] at edu.leipzig.taskman.ejb.NewTask_PropagatingBean.onMessage(NewTask_PropagatingBean.java:180)
      19:40:38,786 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      19:40:38,786 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      19:40:38,786 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      19:40:38,787 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
      19:40:38,787 ERROR [STDERR] at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      19:40:38,787 ERROR [STDERR] at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:495)
      19:40:38,787 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
      19:40:38,787 ERROR [STDERR] at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:116)
      19:40:38,787 ERROR [STDERR] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
      19:40:38,787 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
      19:40:38,788 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      19:40:38,788 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      19:40:38,788 ERROR [STDERR] at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:109)
      19:40:38,788 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      19:40:38,788 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
      19:40:38,788 ERROR [STDERR] at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:402)
      19:40:38,788 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:954)
      19:40:38,789 ERROR [STDERR] at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:987)
      19:40:38,789 ERROR [STDERR] at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1287)
      19:40:38,789 ERROR [STDERR] at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:266)
      19:40:38,789 ERROR [STDERR] at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:902)
      19:40:38,789 ERROR [STDERR] at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
      19:40:38,789 ERROR [STDERR] at org.jboss.mq.SpySession.run(SpySession.java:323)
      19:40:38,790 ERROR [STDERR] at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:194)
      19:40:38,790 ERROR [STDERR] at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
      19:40:38,790 ERROR [STDERR] at java.lang.Thread.run(Thread.java:534)

      Any Ideas?