Exceptions when invoking EJBs from OpenEJB ran as embedded container

View: New views
7 Messages — Rating Filter:   Alert me  

Exceptions when invoking EJBs from OpenEJB ran as embedded container

by recursion :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

After not being able to cope somehow with yesterday's problem about using OpenEJB as a remote server, i ran the same application, this time on OpenEJB used as an embedded engine. Here is what i get now:

1. Caused by: javax.transaction.TransactionRequiredException
        at org.apache.openejb.core.transaction.TxMandatory.<init>(TxMandatory.java:49)
        at org.apache.openejb.core.transaction.JtaTransactionPolicyFactory.createTransactionPolicy(JtaTransactionPolicyFactory.java:44)
        at org.apache.openejb.core.transaction.EjbTransactionUtil.createTransactionPolicy(EjbTransactionUtil.java:55)
        at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:200)Error in statelessMandatoryTxAttribute

        at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:169)
        at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:217)
        at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:77)
        at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
        ... 23 more

(I am calling the MANDATORY bean from a REQUIRED one, so there has to be a transaction started.....)

2.

Exception in thread "pool-1-thread-12" java.lang.IllegalStateException: No tx on thread
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.getActiveTransactionImpl(TransactionManagerImpl.java:194)
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.putResource(TransactionManagerImpl.java:218)
        at org.apache.openejb.core.transaction.JtaTransactionPolicy.putResource(JtaTransactionPolicy.java:116)
        at org.apache.openejb.core.transaction.EjbTransactionUtil.createTransactionPolicy(EjbTransactionUtil.java:59)
        at org.apache.openejb.core.stateful.StatefulContainer.createEJBObject(StatefulContainer.java:295)
        at org.apache.openejb.core.stateful.StatefulContainer.invoke(StatefulContainer.java:263)
        at org.apache.openejb.core.ivm.EjbHomeProxyHandler.create(EjbHomeProxyHandler.java:270)
        at org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:161)
        at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
        at $Proxy11.create(Unknown Source)
at org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
        at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:150)
        at org.apache.openejb.core.ivm.naming.ContextWrapper.lookup(ContextWrapper.java:115)
        at javax.naming.InitialContext.lookup(Unknown Source)

Any ideas ?

Re: Exceptions when invoking EJBs from OpenEJB ran as embedded container

by David Blevins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you have the full, non-trimmed, stack trace that would help.  Also  
are you starting any threads anywhere in your bean code?

-David

On Jun 11, 2009, at 1:40 AM, recursion wrote:

>
> Hi all,
>
> After not being able to cope somehow with yesterday's problem about  
> using
> OpenEJB as a remote server, i ran the same application, this time on  
> OpenEJB
> used as an embedded engine. Here is what i get now:
>
> 1. Caused by: javax.transaction.TransactionRequiredException
> at
> org
> .apache.openejb.core.transaction.TxMandatory.<init>(TxMandatory.java:
> 49)
> at
> org
> .apache
> .openejb
> .core
> .transaction
> .JtaTransactionPolicyFactory
> .createTransactionPolicy(JtaTransactionPolicyFactory.java:44)
> at
> org
> .apache
> .openejb
> .core
> .transaction
> .EjbTransactionUtil.createTransactionPolicy(EjbTransactionUtil.java:
> 55)
> at
> org
> .apache
> .openejb
> .core.stateless.StatelessContainer._invoke(StatelessContainer.java:
> 200)Error
> in statelessMandatoryTxAttribute
>
> at
> org
> .apache
> .openejb
> .core.stateless.StatelessContainer.invoke(StatelessContainer.java:169)
> at
> org
> .apache
> .openejb
> .core
> .ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:
> 217)
> at
> org
> .apache
> .openejb
> .core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:77)
> at
> org
> .apache
> .openejb
> .core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
> ... 23 more
>
> (I am calling the MANDATORY bean from a REQUIRED one, so there has  
> to be a
> transaction started.....)
>
> 2.
>
> Exception in thread "pool-1-thread-12"  
> java.lang.IllegalStateException: No
> tx on thread
> at
> org
> .apache
> .geronimo
> .transaction
> .manager
> .TransactionManagerImpl
> .getActiveTransactionImpl(TransactionManagerImpl.java:194)
> at
> org
> .apache
> .geronimo
> .transaction
> .manager
> .TransactionManagerImpl.putResource(TransactionManagerImpl.java:218)
> at
> org
> .apache
> .openejb
> .core
> .transaction
> .JtaTransactionPolicy.putResource(JtaTransactionPolicy.java:116)
> at
> org
> .apache
> .openejb
> .core
> .transaction
> .EjbTransactionUtil.createTransactionPolicy(EjbTransactionUtil.java:
> 59)
> at
> org
> .apache
> .openejb
> .core
> .stateful.StatefulContainer.createEJBObject(StatefulContainer.java:
> 295)
> at
> org
> .apache
> .openejb
> .core.stateful.StatefulContainer.invoke(StatefulContainer.java:263)
> at
> org
> .apache
> .openejb
> .core.ivm.EjbHomeProxyHandler.create(EjbHomeProxyHandler.java:270)
> at
> org
> .apache
> .openejb
> .core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:161)
> at
> org
> .apache
> .openejb
> .core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
> at $Proxy11.create(Unknown Source)
> at
> org
> .apache
> .openejb
> .core
> .ivm
> .naming.BusinessLocalReference.getObject(BusinessLocalReference.java:
> 33)
> at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:
> 150)
> at
> org
> .apache
> .openejb.core.ivm.naming.ContextWrapper.lookup(ContextWrapper.java:
> 115)
> at javax.naming.InitialContext.lookup(Unknown Source)
>
> Any ideas ?
> --
> View this message in context: http://www.nabble.com/Exceptions-when-invoking-EJBs-from-OpenEJB-ran-as-embedded-container-tp23977489p23977489.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>


Re: Exceptions when invoking EJBs from OpenEJB ran as embedded container

by recursion :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No, in my bean code i do not start threads.
But i do start threads in my client code! There are approximately 10 threads, each one is performing its own lookup of my bean, and is invoking business methods.

Could that be a problem ?

Re: Exceptions when invoking EJBs from OpenEJB ran as embedded container

by David Blevins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jun 11, 2009, at 6:29 AM, recursion wrote:

>
> No, in my bean code i do not start threads.
> But i do start threads in my client code! There are approximately 10
> threads, each one is performing its own lookup of my bean, and is  
> invoking
> business methods.
>
> Could that be a problem ?

Hard to say without knowing exactly where the client code is in the  
call chain.  If it is getting executed anywhere downstream from an ejb  
call (say ejb->client->ejb) then it would cause the issue described.  
If not, then we'll definitely need the entire stack trace to have any  
idea of what may be happing.

-David


Re: Exceptions when invoking EJBs from OpenEJB ran as embedded container

by amanica :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

recursion wrote:
Exception in thread "pool-1-thread-12" java.lang.IllegalStateException: No tx on thread
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.getActiveTransactionImpl(TransactionManagerImpl.java:194)
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.putResource(TransactionManagerImpl.java:218)
        at org.apache.openejb.core.transaction.JtaTransactionPolicy.putResource(JtaTransactionPolicy.java:116)
        at org.apache.openejb.core.transaction.EjbTransactionUtil.createTransactionPolicy(EjbTransactionUtil.java:59)
        at org.apache.openejb.core.stateful.StatefulContainer.createEJBObject(StatefulContainer.java:295)
        at org.apache.openejb.core.stateful.StatefulContainer.invoke(StatefulContainer.java:263)
        at org.apache.openejb.core.ivm.EjbHomeProxyHandler.create(EjbHomeProxyHandler.java:270)
        at org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:161)
        at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
        at $Proxy11.create(Unknown Source)
at org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
        at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:150)
        at org.apache.openejb.core.ivm.naming.ContextWrapper.lookup(ContextWrapper.java:115)
        at javax.naming.InitialContext.lookup(Unknown Source)

Any ideas ?
I got a similar excepion today, and figured out for the second time that it was because of this:
ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which requires a JavaAgent.  See http://openejb.apache.org/3.0/javaagent.html

and from the mentioned page it is clear that you have to add something like the following to your runtime VM args:
-javaagent:openejb-javaagent-3.0-beta-2.jar


Re: Exceptions when invoking EJBs from OpenEJB ran as embedded container

by amanica :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

recursion wrote:
Exception in thread "pool-1-thread-12" java.lang.IllegalStateException: No tx on thread
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.getActiveTransactionImpl(TransactionManagerImpl.java:194)
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.putResource(TransactionManagerImpl.java:218)
        at org.apache.openejb.core.transaction.JtaTransactionPolicy.putResource(JtaTransactionPolicy.java:116)
        at org.apache.openejb.core.transaction.EjbTransactionUtil.createTransactionPolicy(EjbTransactionUtil.java:59)
        at org.apache.openejb.core.stateful.StatefulContainer.createEJBObject(StatefulContainer.java:295)
        at org.apache.openejb.core.stateful.StatefulContainer.invoke(StatefulContainer.java:263)
        at org.apache.openejb.core.ivm.EjbHomeProxyHandler.create(EjbHomeProxyHandler.java:270)
        at org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:161)
        at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
        at $Proxy11.create(Unknown Source)
at org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
        at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:150)
        at org.apache.openejb.core.ivm.naming.ContextWrapper.lookup(ContextWrapper.java:115)
        at javax.naming.InitialContext.lookup(Unknown Source)

Any ideas ?
I got a similar excepion today, and figured out for the second time that it was because of this:
ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which requires a JavaAgent.  See http://openejb.apache.org/3.0/javaagent.html

and from the mentioned page it is clear that you have to add something like the following to your runtime VM args:
-javaagent:openejb-javaagent-3.0-beta-2.jar


Re: Exceptions when invoking EJBs from OpenEJB ran as embedded container

by amanica :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

recursion wrote:
Exception in thread "pool-1-thread-12" java.lang.IllegalStateException: No tx on thread
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.getActiveTransactionImpl(TransactionManagerImpl.java:194)
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.putResource(TransactionManagerImpl.java:218)
        at org.apache.openejb.core.transaction.JtaTransactionPolicy.putResource(JtaTransactionPolicy.java:116)
        at org.apache.openejb.core.transaction.EjbTransactionUtil.createTransactionPolicy(EjbTransactionUtil.java:59)
        at org.apache.openejb.core.stateful.StatefulContainer.createEJBObject(StatefulContainer.java:295)
        at org.apache.openejb.core.stateful.StatefulContainer.invoke(StatefulContainer.java:263)
        at org.apache.openejb.core.ivm.EjbHomeProxyHandler.create(EjbHomeProxyHandler.java:270)
        at org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:161)
        at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
        at $Proxy11.create(Unknown Source)
at org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
        at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:150)
        at org.apache.openejb.core.ivm.naming.ContextWrapper.lookup(ContextWrapper.java:115)
        at javax.naming.InitialContext.lookup(Unknown Source)

Any ideas ?
I got a similar excepion today, and figured out for the second time that it was because of this:
ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which requires a JavaAgent.  See http://openejb.apache.org/3.0/javaagent.html

and from the mentioned page it is clear that you have to add something like the following to your runtime VM args:
-javaagent:openejb-javaagent-3.0-beta-2.jar