Hi guys,
I succeeded in migrating from JBoss 2.0 to the current
JBoss 2.1 PRE (which I checked out from the CVS, on 04-feb-2001).
When I run my code I get the following exception thrown in
a BMP entity bean.
[Translation] Activated bean Translation with id =
org.companion.entity.TranslationPK@2d0e10c
[Translation] XAException: tx=XidImpl [FormatId=257, GlobalId=www//4,
BranchQual=] errorCode=XAER_NOTA
[Translation] javax.transaction.xa.XAException
[Translation] at
org.jboss.minerva.xa.XAResourceImpl.start(XAResourceImpl.java:261)
[Translation] at org.jboss.tm.TxCapsule.startResource(TxCapsule.java:1094)
[Translation] at org.jboss.tm.TxCapsule.enlistResource(TxCapsule.java:575)
[Translation] at
org.jboss.tm.TransactionImpl.enlistResource(TransactionImpl.java:114)
[Translation] at
org.opentools.minerva.jdbc.xa.XAConnectionFactory.prepareObject(XAConnection
Factory.java:269)
[Translation] at
org.opentools.minerva.pool.ObjectPool.getObject(ObjectPool.java:548)
[Translation] at
org.opentools.minerva.pool.ObjectPool.getObject(ObjectPool.java:521)
[Translation] at
org.opentools.minerva.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSourc
e.java:165)
[Translation] at
org.companion.entity.TranslationBean.ejbLoad(TranslationBean.java:317)
... There is lots more in the server.log, but I spare you the details.
Here is what happens, that is as far as I could figure it out.
o I issue a findAll() from within a stateless Session CMT bean
on the BMP entity beans home interface.
This invokes ejbFindAll() of the bean.
That returns a Collection of PK's
o Next the container tries to load all the entities
implied by the PK's in the Collection.
In order to do that the container calls ejbLoad()
o Within the ejbLoad I issue the following lines of code:
ds = (DataSource)ctxt.lookup("java:comp/env/source1");
con = ds.getConnection();
The same sequence of calls is issued in the ejbFindAll() and the
connection
is neatly closed afterwards.
Still in the ejbLoad() the call to getConnection() throws the above
exception.
The reason for this is that the getConnection() triggers a new transaction,
via org.jboss.minerva.xa.XAResourceImpl.start(). The start however checks
if there is still a current Xid available and there is!
public void start(Xid id, int flags) throws
javax.transaction.xa.XAException {
if(active) {// Start was called twice!
if(current != null && id.equals(current))
throw new XAException(XAException.XAER_DUPID);
else
throw new XAException(XAException.XAER_PROTO);
}
if(current != null) // <----- This is where the exception is
thrown !!!!
throw new XAException(XAException.XAER_NOTA);
if(con == null)
throw new XAException(XAException.XA_RBOTHER);
current = id;
active = true;
}
The only way for me to get this going is to perform a commit or a rollback
from
within the BMP bean, which strikes me as odd, since I only read here.
Furthermore
it is a Container Managed Transaction, so I shouldn't have to bother at all
about
committing and rolling back.
To fill in a bit more on the background. I use Interbase 6.0, which worked
with 2.0 FINAL.
I noticed some subtle changes in the jboss.jcml to set up the pool, but the
log tells me
that it could bound the Interbase pool to java:/Interbase. See server.log
fraction below.
[Interbase] Starting
[Interbase] XA Connection pool Interbase bound to java:/Interbase
[Interbase] Started
Any ideas fellows?
Regards,
Cor.
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]