Bugs item #845637, was opened at 2003-11-20 09:03
Message generated for change (Comment added) made by ejort
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=845637&group_id=22866

>Category: JBossServer
Group: v3.2
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Alexei Yudichev (sflexus)
>Assigned to: Adrian Brock (ejort)
Summary: findByPrimaryKey() finds uncommitted entity

Initial Comment:
Jboss 3.2.2, 3.2.3RC1.

I have a test code in my app which looks like:

    UserTransaction userTransaction = 
getUserTransaction();
    userTransaction.begin();
    try {
       //...
       someSLSB.someMethod();
       //...
    } finally {
      userTransaction.rollback();
    }

someMethod() has Tx attribute "requires". someMethod() 
creates entity bean and then sends JMS message to 
queue with the primary key of the entity just created. 
MDB gets this message and tries to find the entity by 
primary key and then invoke methods on it. Interesting 
thing is that it does find the entity (even though a 
transaction that created it has never been commited)! 
Subsequent attempt to invoke a business method on the 
entity leads to javax.ejb.NoSuchObjectLocalException 
(stack trace is below). 

javax.ejb.NoSuchObjectLocalException: Entity not found: 
primaryKey=85
        at org.jboss.ejb.plugins.AbstractTxInterceptor.
invokeNext(AbstractTxInterceptor.java:158)
        at org.jboss.ejb.plugins.TxInterceptorCMT.
runWithTransactions(TxInterceptorCMT.java:267)
        at org.jboss.ejb.plugins.TxInterceptorCMT.
invoke(TxInterceptorCMT.java:128)
        at org.jboss.ejb.plugins.SecurityInterceptor.
invoke(SecurityInterceptor.java:118)
        at org.jboss.ejb.plugins.LogInterceptor.
invoke(LogInterceptor.java:191)
        at org.jboss.ejb.plugins.
ProxyFactoryFinderInterceptor.
invoke(ProxyFactoryFinderInterceptor.java:122)
        at org.jboss.ejb.EntityContainer.
internalInvoke(EntityContainer.java:490)
        at org.jboss.ejb.Container.invoke(Container.java:
700)
        at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.
invoke(BaseLocalProxyFactory.java:375)
        at org.jboss.ejb.plugins.local.EntityProxy.
invoke(EntityProxy.java:38)
        at $Proxy2237.getRecipient(Unknown Source)
        at com.tw.mms.ejb.MMSSenderQBean.
onMessage(MMSSenderQBean.java:34)
        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:324)
        at org.jboss.ejb.
MessageDrivenContainer$ContainerInterceptor.
invoke(MessageDrivenContainer.java:460)
        at org.jboss.resource.connectionmanager.
CachedConnectionInterceptor.
invoke(CachedConnectionInterceptor.java:185)
        at org.jboss.ejb.plugins.
MessageDrivenInstanceInterceptor.
invoke(MessageDrivenInstanceInterceptor.java:62)
        at org.jboss.ejb.plugins.AbstractTxInterceptor.
invokeNext(AbstractTxInterceptor.java:84)
        at org.jboss.ejb.plugins.TxInterceptorCMT.
runWithTransactions(TxInterceptorCMT.java:267)
        at org.jboss.ejb.plugins.TxInterceptorCMT.
invoke(TxInterceptorCMT.java:128)
        at org.jboss.ejb.plugins.RunAsSecurityInterceptor.
invoke(RunAsSecurityInterceptor.java:90)
        at org.jboss.ejb.plugins.LogInterceptor.
invoke(LogInterceptor.java:191)
        at org.jboss.ejb.plugins.
ProxyFactoryFinderInterceptor.
invoke(ProxyFactoryFinderInterceptor.java:122)
        at org.jboss.ejb.MessageDrivenContainer.
internalInvoke(MessageDrivenContainer.java:374)
        at org.jboss.ejb.Container.invoke(Container.java:
700)
        at org.jboss.ejb.plugins.jms.JMSContainerInvoker.
invoke(JMSContainerInvoker.java:824)
        at org.jboss.ejb.plugins.jms.
JMSContainerInvoker$MessageListenerImpl.
onMessage(JMSContainerInvoker.java:1114)
        at org.jboss.jms.asf.StdServerSession.
onMessage(StdServerSession.java:256)
        at org.jboss.mq.SpyMessageConsumer.
sessionConsumerProcessMessage(SpyMessageConsumer.
java:633)
        at org.jboss.mq.SpyMessageConsumer.
addMessage(SpyMessageConsumer.java:433)
        at org.jboss.mq.SpySession.run(SpySession.java:
298)
        at org.jboss.jms.asf.StdServerSession.
run(StdServerSession.java:180)
        at EDU.oswego.cs.dl.util.concurrent.
PooledExecutor$Worker.run(PooledExecutor.java:727)
        at java.lang.Thread.run(Thread.java:534)


----------------------------------------------------------------------

>Comment By: Adrian Brock (ejort)
Date: 2003-11-26 09:10

Message:
Logged In: YES 
user_id=9459

This is the expected behaviour when using the instance cache.

If you want complete isolation, you should use the 
"Instance per Transaction" configuration.
See conf/standardjboss.xml

Regards,
Adrian

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=845637&group_id=22866


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to