Hi everybody,

I use Castor in a BMP Entity EJB, deployed on Borland AppServer with
container managed transactions. 
The underlying database is Oracle 9.
In com.xyz.MyBean I create and configure the JDO and get a Database
connection from it:
      jdo = new JDO();
      jdo.setDatabaseName("dbname");
      jdo.setConfiguration(".../database.xml");
      jdo.setClassLoader(this.getClass().getClassLoader());
      Database db = jdo.getDatabase();
So far it works.
In the corresponding methods I create or update data base records for
com.xyz.MyClass:
           db.begin();
           db.create(object);
           db.commit();
So far it works.
Now the problem is that when from my JUnit test application I try to get a
member variable through a get method like this:
           private Date date;    // this is the member variable
           publlic Date getDate() {
             return date;
           }
the server throws in the console an exception like this:
     [exec] java.lang.IllegalStateException: Transaction
org.exolab.castor.jdo.engine.TransactionContextImpl@5364 does not hold the
read lock: com.xyz.MyClass
     [exec]     at
org.exolab.castor.persist.LockEngine$TypeInfo.assure(UnknownSource)
     [exec]     at
org.exolab.castor.persist.LockEngine$TypeInfo.access$500(Unknown Source)
     [exec]     at org.exolab.castor.persist.LockEngine.revertObject(Unknown
Source)
     [exec]     at
org.exolab.castor.persist.TransactionContext.rollback(Unknown Source)
     [exec]     at org.exolab.castor.jdo.engine.DatabaseImpl.close(Unknown
Source)
     [exec]     at com.xyz.MyBean.closeDatabase(MyBean.java:751)
     [exec]     at com.xyz.MyBean.ejbStore(MyBean.java:478)
     [exec]     at java.lang.reflect.Method.invoke(Native Method)
     [exec]     at
com.inprise.ejb.ConcreteMethod.invoke(ConcreteMethod.java:25)
     [exec]     at com.inprise.ejb.EJBContext.invoke(EJBContext.java:133)
     [exec]     at com.inprise.ejb.Dispatcher.doInvoke(Dispatcher.java:1070)
     [exec]     at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:582)
     [exec]     at com.inprise.ejb.Dispatcher.store(Dispatcher.java:533)
     [exec]     at com.inprise.ejb.Dispatcher$1.invoke(Dispatcher.java:665)
     [exec]     at
com.inprise.ejb.SynchronizationPool$Synchronization.doCallback(Synchronizati
onPool.java:227)
     [exec]     at
com.inprise.ejb.SynchronizationPool$Synchronization.before_completion(Synchr
onizationPool.java:255)
     [exec]     at
org.omg.CosTransactions._SynchronizationStub.before_completion(_Synchronizat
ionStub.java:56)
     [exec]     at
com.inprise.ejb.jts.Transaction.commit(Transaction.java:230)
     [exec]     at
org.omg.CosTransactions._TerminatorStub.commit(_TerminatorStub.java:65)
     [exec]     at com.inprise.ejb.jts.gen._TxStub.commit(_TxStub.java:46)
     [exec]     at
com.visigenic.services.CosTransactions.CurrentImpl.commit(CurrentImpl.java:2
55)
     [exec]     at
com.visigenic.services.CosTransactions.TSCurrentManager.commit(TSCurrentMana
ger.java:87)
     [exec]     at
com.inprise.visitransact.jta.UserTransaction.commit(UserTransaction.java:31)
     [exec]     at com.inprise.ejb.Dispatcher.doInvoke(Dispatcher.java:1342)
     [exec]     at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:582)
     [exec]     at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:550)
     [exec]     at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:257)
     [exec]     at
com.xyz.MyBeanPOAInvokeHandler.getTarget(MyBeanPOAInvokeHandler.java:77)
     [exec]     at
com.xyz.MyBeanPOAInvokeHandler.getTarget(MyBeanPOAInvokeHandler.java:193)
     [exec]     at com.xyz.MyBeanPOA._invoke(MyBeanPOA.java:87)
     [exec]     at com.xyz.MyBeanPOA._invoke(MyBeanPOA.java:61)
     [exec]     at com.inprise.vbroker.poa.POAImpl.invoke(POAImpl.java:2355)
     [exec]     at
com.inprise.vbroker.poa.ActivationRecord.invoke(ActivationRecord.java:104)
     [exec]     at
com.inprise.vbroker.poa.ServerInterceptorManager$ARWrapper.invoke(ServerInte
rceptorManager.java:64)
     [exec]     at
com.inprise.vbroker.GIOP.GiopProtocolAdapter.doRequest(GiopProtocolAdapter.j
ava:492)
     [exec]     at
com.inprise.vbroker.IIOP.ServerProtocolAdapter.doRequest(ServerProtocolAdapt
er.java:64)
     [exec]     at
com.inprise.vbroker.GIOP.GiopProtocolAdapter.dispatchMessage(GiopProtocolAda
pter.java:653)
     [exec]     at
com.inprise.vbroker.orb.TPDispatcherImpl$TPDispatcher.run(TPDispatcherImpl.j
ava:99)
     [exec]     at
com.inprise.vbroker.orb.ThreadPool$PoolWorker.run(ThreadPool.java:76)

I assumed, that the problem is because I start and stop castor transactions
with db.begin() and db.commit().
So I desided to use the container transactions. 
But after I commented out db.begin() and db.commit() the next exception is
being thrown from the server and caught by the client when I call create()
or find() method of the bean:
java.rmi.ServerException: ; nested exception is: 
        java.rmi.RemoteException: No transaction in progress for the current
thread; nested exception is: 
        org.exolab.castor.jdo.TransactionNotInProgressException: No
transaction in progress for the current thread
java.rmi.RemoteException: No transaction in progress for the current thread;
nested exception is: 
        org.exolab.castor.jdo.TransactionNotInProgressException: No
transaction in progress for the current thread
org.exolab.castor.jdo.TransactionNotInProgressException: No transaction in
progress for the current thread
        <<no stack trace available>>

I would appreciate very much if anybody can give me an idea what to do.

Thanks a lot.

Lyubo.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to