Problems with TM in ejbCreate()

2004-08-06 Thread =?iso-8859-1?q?Dino=20Di=20Cola?=
Dear all,
I encountered some problems with Transaction
Management porting my J2EE application from Ora9ias
9.0.2 to Ora9ias 9.0.3 platform.
I tried to reproduce the problem with a simple J2EE
application made up of a test stateless session bean
with a single business method.
This very simple J2EE application is deployed
successfully both in Ora9ias 9.0.2 and Ora9ias 9.0.3.
The business method (test_odmg()) can be successfully
invoked by a RMI client on the Ora9ias 9.0.2
deployment.
On the Ora9ias 9.0.3 deployment however I get the
following error:

The following exception has been catched: Error in
ejbCreate(): No external transaction found; nested
exception is:
org.odmg.TransactionNotInProgressException: No
external transaction found
com.evermind.server.rmi.OrionRemoteException: Error
in ejbCreate(): No external transaction found
at
com.evermind.server.ejb.StatelessSessionEJBHome.getContextInstance(StatelessSessionEJBHome.java:267)
at
OJBTest_ODMG_StatelessSessionBeanWrapper52.test_odmg(OJBTest_ODMG_StatelessSessionBeanWrapper52.java:83)
at java.lang.reflect.Method.invoke(Native
Method)
at
com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:119)
at
com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:479)
at connection to c99-012.prirm.pride.it/10.2.21.8 as
admin
at
com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMIConnection.java:1558)
at
com.evermind.server.rmi.RMIConnection.invokeMethod(RMIConnection.java:1511)
at
com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:55)
at
com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:22)
at
com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:50)
at __Proxy4.test_odmg(Unknown Source)
at
it.enidata.psv.ejb.client.TestOJB_ODMG.main(TestOJB_ODMG.java:45)

Nested exception is:
org.odmg.TransactionNotInProgressException: No
external transaction found
at
org.apache.ojb.odmg.JTATxManager.registerTx(Unknown
Source)
at
org.apache.ojb.odmg.TransactionImpl.begin(Unknown
Source)
at
org.apache.ojb.odmg.ImplementationJTAImpl.beginInternTransaction(Unknown
Source)
at
org.apache.ojb.odmg.ImplementationJTAImpl.registerOpenDatabase(Unknown
Source)
at
org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source)
at
it.enidata.psv.ejb.account.OJBTest_ODMGBean.init(OJBTest_ODMGBean.java:99)
at
it.enidata.psv.ejb.account.OJBTest_ODMGBean.ejbCreate(OJBTest_ODMGBean.java:41)
at
OJBTest_ODMGHome_StatelessSessionHomeWrapper53.callCreate(OJBTest_ODMGHome_StatelessSessionHomeWrapper53.java:145)
at
com.evermind.server.ejb.StatelessSessionEJBHome.getContextInstance(StatelessSessionEJBHome.java:254)
at
OJBTest_ODMG_StatelessSessionBeanWrapper52.test_odmg(OJBTest_ODMG_StatelessSessionBeanWrapper52.java:83)
at java.lang.reflect.Method.invoke(Native
Method)
at
com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:119)
at
com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:479)
at connection to c99-012.prirm.pride.it/10.2.21.8
at
com.evermind.server.rmi.OrionRemoteException.receive(OrionRemoteException.java:130)
at
com.evermind.server.rmi.RMIConnection.handleMethodInvocationResponse(RMIConnection.java:1673)
at
com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:532)
at
com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:275)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:797)
at java.lang.Thread.run(Thread.java:484)

The error arises in the ejbCreate() as soon as the
db.open() is invoked. 
- If I move the OJB initialization into the business
method (leaving the EJB as stateless) the error
disappears.
- If I change the deployment descriptor from
stateless to stateful (leaving the OJB
initialization into the ejbCreate()) the error
disappears.
What is the rationale behind this behaviour?

Here below you will find 
- the source code of the test session bean
- the deployment descriptor
- the OJB.properties

Any assitance in the matter would be great. 
Thanks in advance.

Regards,


Dino.
--

***
 Source code for the session bean
*
***
public class OJBTest_ODMGBean implements SessionBean {


Re: Problems with TM in ejbCreate()

2004-08-06 Thread =?iso-8859-1?q?Dino=20Di=20Cola?=
Dear Armin,
first of all thanks for your prompt reply!

I applied the change to the
ImplementationJTAImpl#registerOpenDatabase and
executed the test from scratch. 
My simple test application works fine now.
I deployed also the main J2EE application and works
also there at first sight.

I would like to have more insight from you regarding
the patch you proposed to apply in
ImplementationJTAImpl class.

1. You wrote the following: OJB always lookup a
running JTA-transaction this can't be successful when
db.open(...) is called on ejbCreate().
   Could you please give me more info? I cannot see
the problem with ejbCreate(). Thanks!

2. You wrote me it could be a bug in odmg
implementation. And clearly you seems right. 
   I cannot understand however why it was successfully
running on previous versions of ora9ias!?!

3. I commented out the beginInternTransaction()
invocation. Clearly this method is equally invoked
following another code flow. 
   Does it mean it was called twice before your patch?

4. My Session Bean is substantially very close to
src\ejb\org\apache\ojb\ejb\odmg\ODMGSessionBean.java
(taken from the db-ojb-1.0.rc7 distribution).
   The only difference I note is on the Required
attribute marked in the ODMGSessionBean.java javadoc.
I use NotSupported instead. 
   Have I to change the attribute to Required?

5. I am quite sure about this bug (anyway I will check
it more and more and I will keep you informed). 
   If you are certain of this bug too, in what release
do you think to fix it? 
   Have you planned a target release date for next OJB
release?
   What can I do in the meantime a new release will be
officially distributed? 

Armin, I really appreciated your help.
Hope you will answer to all my questions without
getting bored :)

Thanks, 

d.
--








Yahoo! Companion - Scarica gratis la toolbar di Ricerca di Yahoo! 
http://companion.yahoo.it

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]