|
|
In the BAS 4.5.1 "pkgen" (Portable Sequence Number Generator) example when a row does *not* exist in the "Sequence" table (say an empty sequence table to start with) and a call to the SequenceGenerator SLSB occurs getNextSequenceNumber("Employee"), the container throws a javax.transaction.InvalidTransactionException (see below for complete server side debug trace). |
| From http://groups.google.com/groups?selm=3adc667b_2%40dnews&output=gplain
From: "Krishnan Subramanian" krish@crisp.nl I was just going through the pkgen example - the Portable Sequence Number Generator.
BAS 4.5.1 Sun JDK 1.3 NT 4 Workstation + SP6 Problem: when a row does *not* exist in the "Sequence" table (say an empty sequence table to start with) and a call to the SequenceGenerator SLSB occurs
getNextSequenceNumber("Employee"),
the container throws a javax.transaction.InvalidTransactionException
(see below for complete server side debug trace). The transaction attribute for the SLSB (SequenceGenerator) is "Required" and for the Sequence entity bean is "RequiresNew". (as per the docs.)
The error disappears when the transaction attribute
for the Sequence Entity bean's home interface methods
are set to "Required" and the remote interface methods
(including the getValueBeforeIncrementingBy) are set
to "RequiredNew". (Which I suspect is the cause of
the error since the create() is in one transaction while
the incrementing is in another?)
| |
---<Server side debug>-------------------------------- *sc* received request: CORBA::Object.root_context *sc* received request: CORBA::Object.resolve *sc* received request: CORBA::Object._is_a *sc* received request: CORBA::Object.create *sc* received request: CORBA::Object.getNextSequenceNumber StatelessSessionHome.ServantLocator.preinvoke: getNextSequenceNumber *st* prepare context1 NOT_EXIST --[setContext:setSessionContext]--> SET_CONTEXT Invoking method void com.foliquest.pkgen.SequenceGenerator.setSessionContext(javax.ejb.SessionCon text=SessionContext[id=1,state=NOT_EXIST]) completed com.foliquest.pkgen.SequenceGenerator.setSessionContext() *st* commit context1 NOT_EXIST --[setContext:setSessionContext]--> SET_CONTEXT *st* prepare context1 SET_CONTEXT --[create:create]--> READY Invoking method com.foliquest.pkgen.SequenceGeneratorRemote com.foliquest.pkgen.SequenceGenerator.create() result com.foliquest.pkgen.SequenceGeneratorRemote=null com.foliquest.pkgen.SequenceGenerator.create() *st* commit context1 SET_CONTEXT --[create:create]--> READY *st* prepare context1 READY --[method:getNextSequenceNumber]--> READY *tx* Dispatcher.invoke: tx.begin(serverTransaction) Invoking method int com.foliquest.pkgen.SequenceGenerator.getNextSequenceNumber(java.lang.String =Employee) transaction attribute Required transaction status StatusActive *st* prepare context2 NOT_EXIST --[setContext:setEntityContext]--> POOLED *tx* Dispatcher.invoke: tx.suspend(callerTransaction) Invoking method void com.foliquest.pkgen.Sequence.setEntityContext(javax.ejb.EntityContext=Entity Context[id=2,state=NOT_EXIST]) completed com.foliquest.pkgen.Sequence.setEntityContext() *tx* Dispatcher.invoke: tx.resume(callerTransaction) *st* commit context2 NOT_EXIST --[setContext:setEntityContext]--> POOLED *st* prepare context2 POOLED --[find:ejbFindByPrimaryKey]--> POOLED *tx* Dispatcher.invoke: tx.suspend(callerTransaction) *tx* Dispatcher.invoke: tx.begin(serverTransaction) Invoking method com.foliquest.pkgen.SequenceRemote com.foliquest.pkgen.Sequence.ejbFindByPrimaryKey(java.lang.String=Employee) transaction attribute RequiresNew transaction status StatusActive *cm* findByPrimaryKey(java.lang.String name): SELECT name, tableIndex FROM Sequence WHERE name = ?; args: [java.lang.String name] *cm* datasource: jdbc/fisdb *cm* reuseStatements: true *cm* dialect: none *cm* pk fields: java.lang.String name *cm* cm fields: int tableIndex *cm* create: INSERT INTO Sequence (name, tableIndex) VALUES (?, ?) *cm* remove: DELETE FROM Sequence WHERE name = ? *cm* findByPrimaryKey: SELECT name, tableIndex FROM Sequence WHERE name = ? *cm* load: SELECT tableIndex FROM Sequence WHERE name = ? *cm* store: UPDATE Sequence SET tableIndex = ? WHERE name = ? *cm* execute findByPrimaryKey(java.lang.String name) "SELECT name, tableIndex FROM Sequence WHERE name = ?" args: [Employee] call threw exception com.foliquest.pkgen.Sequence.ejbFindByPrimaryKey() *tx* Dispatcher.invoke: tx.commit(serverTransaction) *tx* Dispatcher.invoke: tx.resume(callerTransaction) *st* commit context2 POOLED --[find:ejbFindByPrimaryKey]--> POOLED *st* prepare context2 POOLED --[create:create]--> HALF_CREATED *tx* Dispatcher.invoke: tx.suspend(callerTransaction) *tx* Dispatcher.invoke: tx.begin(serverTransaction) Invoking method com.foliquest.pkgen.SequenceRemote com.foliquest.pkgen.Sequence.create(java.lang.String=Employee) transaction attribute RequiresNew transaction status StatusActive *cm* execute findByPrimaryKey(java.lang.String name) "SELECT name, tableIndex FROM Sequence WHERE name = ?" args: [Employee] *cm* execute create "INSERT INTO Sequence (name, tableIndex) VALUES (?, ?)" args: [Employee]:[0] result com.foliquest.pkgen.SequenceRemote=Employee com.foliquest.pkgen.Sequence.create() *tx* Dispatcher.invoke: tx.commit(serverTransaction) *tx* Dispatcher.invoke: tx.resume(callerTransaction) *st* commit context2 POOLED --[create:create]--> HALF_CREATED *st* prepare context2 HALF_CREATED --[postCreate:create]--> READY *tx* Dispatcher.invoke: tx.suspend(callerTransaction) *tx* Dispatcher.invoke: tx.begin(serverTransaction) Invoking method com.foliquest.pkgen.SequenceRemote com.foliquest.pkgen.Sequence.create(java.lang.String=Employee) transaction attribute RequiresNew transaction status StatusActive result com.foliquest.pkgen.SequenceRemote=null com.foliquest.pkgen.Sequence.create() *tx* Dispatcher.invoke: tx.commit(serverTransaction) *tx* Dispatcher.invoke: tx.resume(callerTransaction) *st* commit context2 HALF_CREATED --[postCreate:create]--> READY *st* prepare context2 READY --[method:getValueBeforeIncrementingBy]--> READY *tx* Dispatcher.invoke: tx.suspend(callerTransaction) *tx* Dispatcher.invoke: tx.begin(serverTransaction) *tx* Dispatcher.invoke: tx.commit(serverTransaction) *tx* Dispatcher.invoke: tx.resume(callerTransaction) *st* commit context2 READY --[method:getValueBeforeIncrementingBy]--> READY *st* prepare context2 READY --[method:getValueBeforeIncrementingBy]--> READY *tx* Dispatcher.invoke: tx.suspend(callerTransaction) *tx* Dispatcher.invoke: tx.begin(serverTransaction) *tx* Dispatcher.invoke: tx.commit(serverTransaction) *tx* Dispatcher.invoke: tx.resume(callerTransaction) *st* commit context2 READY --[method:getValueBeforeIncrementingBy]--> READY *st* prepare context2 READY --[method:getValueBeforeIncrementingBy]--> READY *tx* Dispatcher.invoke: tx.suspend(callerTransaction) *tx* Dispatcher.invoke: tx.begin(serverTransaction) *tx* Dispatcher.invoke: tx.commit(serverTransaction) *tx* Dispatcher.invoke: tx.resume(callerTransaction) *st* commit context2 READY --[method:getValueBeforeIncrementingBy]--> READY call threw exception com.foliquest.pkgen.SequenceGenerator.getNextSequenceNumber() >>>> EJB LOG >>>> A non application exception was thrown by the method: public abstract int com.foliquest.pkgen.SequenceGeneratorRemote.getNextSequenceNumber(java.lang. String) throws java.rmi.RemoteException java.rmi.ServerException: null; nested exception is: javax.transaction.InvalidTransactionException: CORBA INVALID_TRANSACTION 0[Cannot invoke a bean first in one transaction, and then in another] javax.transaction.InvalidTransactionException: CORBA INVALID_TRANSACTION 0[Cannot invoke a bean first in one transaction, and then in another] at java.lang.reflect.Constructor.newInstance(Native Method) at com.inprise.vbroker.rmi.CORBA.UtilImpl.newInstance(UtilImpl.java:99) at com.inprise.vbroker.rmi.CORBA.UtilImpl._mapSystemException(UtilImpl.java:355 ) at com.inprise.vbroker.rmi.CORBA.UtilImpl.mapSystemException(UtilImpl.java:572) at javax.rmi.CORBA.Util.mapSystemException(Util.java:67) at com.foliquest.pkgen._SequenceRemote_Stub.getValueBeforeIncrementingBy(_Seque nceRemote_Stub.java:68) at com.foliquest.pkgen.SequenceGenerator.getNextSequenceNumber(SequenceGenerato r.java:85) at java.lang.reflect.Method.invoke(Native Method) at com.inprise.ejb.ConcreteMethod.invoke(ConcreteMethod.java:25) at com.inprise.ejb.EJBContext.invoke(EJBContext.java:129) at com.inprise.ejb.Dispatcher.doInvoke(Dispatcher.java:1055) at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:572) at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:548) at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:255) at com.foliquest.pkgen.SequenceGeneratorRemotePOAInvokeHandler.getNextSequenceN umber(SequenceGeneratorRemotePOAInvokeHandler.java:35) at com.foliquest.pkgen.SequenceGeneratorRemotePOAInvokeHandler.getNextSequenceN umber(SequenceGeneratorRemotePOAInvokeHandler.java:69) at com.foliquest.pkgen.SequenceGeneratorRemotePOA._invoke(SequenceGeneratorRemo tePOA.java:63) at com.foliquest.pkgen.SequenceGeneratorRemotePOA._invoke(SequenceGeneratorRemo tePOA.java:43) at com.inprise.vbroker.poa.POAImpl.invoke(POAImpl.java:2355) at com.inprise.vbroker.poa.ActivationRecord.invoke(ActivationRecord.java:104) at com.inprise.vbroker.poa.ServerInterceptorManager$ARWrapper.invoke(ServerInte rceptorManager.java:64) at com.inprise.vbroker.GIOP.GiopProtocolAdapter.doRequest(GiopProtocolAdapter.j ava:492) *tx* Dispatcher.invoke: tx.setRollbackOnly() at com.inprise.vbroker.IIOP.ServerProtocolAdapter.doRequest(ServerProtocolAdapt er.java:64) at com.inprise.vbroker.GIOP.GiopProtocolAdapter.dispatchMessage(GiopProtocolAda pter.java:653) at com.inprise.vbroker.orb.TPDispatcherImpl$TPDispatcher.run(TPDispatcherImpl.j ava:99) at com.inprise.vbroker.orb.ThreadPool$PoolWorker.run(ThreadPool.java:76) <<<< EJB LOG <<<< >>>> EJB LOG >>>> Throwing java.rmi.RemoteException for the container-started transaction for method: public abstract int com.foliquest.pkgen.SequenceGeneratorRemote.getNextSequenceNumber(java.lang. String) throws java.rmi.RemoteException java.rmi.ServerException: null; nested exception is: javax.transaction.InvalidTransactionException: CORBA INVALID_TRANSACTION 0[Cannot invoke a bean first in one transaction, and then in another] javax.transaction.InvalidTransactionException: CORBA INVALID_TRANSACTION 0[Cannot invoke a bean first in one transaction, and then in another] at java.lang.reflect.Constructor.newInstance(Native Method) at com.inprise.vbroker.rmi.CORBA.UtilImpl.newInstance(UtilImpl.java:99) at com.inprise.vbroker.rmi.CORBA.UtilImpl._mapSystemException(UtilImpl.java:355 ) at com.inprise.vbroker.rmi.CORBA.UtilImpl.mapSystemException(UtilImpl.java:572) at javax.rmi.CORBA.Util.mapSystemException(Util.java:67) at com.foliquest.pkgen._SequenceRemote_Stub.getValueBeforeIncrementingBy(_Seque nceRemote_Stub.java:68) at com.foliquest.pkgen.SequenceGenerator.getNextSequenceNumber(SequenceGenerato r.java:85) at java.lang.reflect.Method.invoke(Native Method) at com.inprise.ejb.ConcreteMethod.invoke(ConcreteMethod.java:25) at com.inprise.ejb.EJBContext.invoke(EJBContext.java:129) at com.inprise.ejb.Dispatcher.doInvoke(Dispatcher.java:1055) at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:572) at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:548) at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:255) at com.foliquest.pkgen.SequenceGeneratorRemotePOAInvokeHandler.getNextSequenceN umber(SequenceGeneratorRemotePOAInvokeHandler.java:35) at com.foliquest.pkgen.SequenceGeneratorRemotePOAInvokeHandler.getNextSequenceN umber(SequenceGeneratorRemotePOAInvokeHandler.java:69) at com.foliquest.pkgen.SequenceGeneratorRemotePOA._invoke(SequenceGeneratorRemo tePOA.java:63) at com.foliquest.pkgen.SequenceGeneratorRemotePOA._invoke(SequenceGeneratorRemo tePOA.java:43) at com.inprise.vbroker.poa.POAImpl.invoke(POAImpl.java:2355) at com.inprise.vbroker.poa.ActivationRecord.invoke(ActivationRecord.java:104) at com.inprise.vbroker.poa.ServerInterceptorManager$ARWrapper.invoke(ServerInte rceptorManager.java:64) at com.inprise.vbroker.GIOP.GiopProtocolAdapter.doRequest(GiopProtocolAdapter.j ava:492) *tx* Dispatcher.doInvoke: discarding the instance *st* commit context1 READY --[kill]--> KILLED *tx* Dispatcher.invoke: tx.rollback(serverTransaction) StatelessSessionHome.ServantLocator.postinvoke: getNextSequenceNumber at com.inprise.vbroker.IIOP.ServerProtocolAdapter.doRequest(ServerProtocolAdapt er.java:64) at com.inprise.vbroker.GIOP.GiopProtocolAdapter.dispatchMessage(GiopProtocolAda pter.java:653) at com.inprise.vbroker.orb.TPDispatcherImpl$TPDispatcher.run(TPDispatcherImpl.j ava:99) at com.inprise.vbroker.orb.ThreadPool$PoolWorker.run(ThreadPool.java:76) <<<< EJB LOG <<<< ---</Server side debug>--------------------------------2001-Sep-04 9:19am gyles19@visi.com | |
| [Append to This Answer] | |
| 2001-Sep-04 9:19am |
| ||||||||
|
Java Community
Java Tools |
Code Central JB OpenTools |
Community Recent Threads |
Borland Chat Chat FAQ |
||||||||||||||
|
Feature Matrices 3.0 | 3.5 | 4.0 5.0 | 6.0 | 7.0 |
Shop for JBuilder |
JBuilder Downloads and reg keys |
Report Piracy | ||||||||||||||
|
Online Manuals 4.0 | 5.0 | 6.0 7.0 |
Borland DevSupport's Bug/RFE Form Quality Central Client |
JB Patches & Updates |
JBuilder FAQs TIs | ||||||||||||||
|
JBuilder Newsgroups |
Tamaracka's News Archive |
Mr. Haki's JBuilder Machine |
JGuru's JBuilder FAQ |
||||||||||||||
|
Sun's Bug Parade |
|||||||||||||||||
|
|||||||||||||||||