RE: Antwort: [JBoss-user] can't enlist error on second pass through resource adapter

2003-01-10 Thread GROVE,MIKE (HP-FtCollins,ex1)



reordering did fix the problem, thanks. however, shouldn't my 
previous ordering have worked as well? i wouldexpect thatin a 
CMT case, the transaction is begun and committed outside the calls to 
getConnection/close. i would expect this ordering to work in a BMT case as 
well.

i've noticed with my BMT EJB thatswapping the order of 
Connection.close and UserTransaction.commit doesn't seem to affect 
behavior. but as we've just seen, swapping 
UserTransaction.begin and ConnectionFactory.getConnection breaks the 
enlistment/delistment. is this a bug, or am i missing something in the 
spec that requires the getConnection call to proceed the beginning of a 
UserTransaction?

thanks.

-mike

-Original Message-From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED]]Sent: Friday, January 10, 2003 1:43 
AMTo: [EMAIL PROTECTED]Subject: Antwort: 
[JBoss-user] "can't enlist" error on second pass through resource 
adapterFirst check if 
reordering of getConnection() and getUserTransaction() will solve your 
problem  
javax.resource.cci.ConnectionFactory conFac = 
(javax.resource.cci.ConnectionFactory)  ctx.lookup 
("java:comp/env/HPIARM");cx = 
conFac.getConnection(); 
tran = (UserTransaction) context.getUserTransaction();  tran.begin(); . 
If not, than start step 
debugging of JBoss-internal transaction/connection manager code when calling 
cx.close() on first ejb invocation. Look for correct calls of 
org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener.delist() 
on your previously ( inside tran.begin() ) enlisted resource. 
Ulf Schroeter

  
  
    
"GROVE,MIKE (HP-FtCollins,ex1)" 
  [EMAIL PROTECTED] Gesendet von: [EMAIL PROTECTED] 
  10.01.2003 00:08 Bitte antworten an jboss-user 
An:   
   "'[EMAIL PROTECTED]'" 
  [EMAIL PROTECTED] Kopie:
   
  Thema:[JBoss-user] "can't enlist" error on 
  second pass through resource 
adapterjboss gurus,  
i'm trying to port a resource adapter to 
jboss to investigate the feasibility/cost of using this resource adapter with 
jboss. i'm using jboss 3.0.4 with tomcat 4.1.12. my jdk is 1.3.1.06. 
platform is w2kp sp3. the resource adapter supports XA. 
res-sharing-scope is set to Unshareable in the ejb-jar.xml file of the EJB 
that uses the resource adapter.  the resource adapter 
worked fine in the following use case with both oracle's 9.0.3 oc4j and HP 
Bluestone's TeS 7.3. the use case is as follows:  i have a stateless session bean that begins a BMT, looks up the resource 
adapter, performs some work on it (via the Interaction interface), closes the 
connection, and commits the transaction. e.g.:   InitialContext ctx = new InitialContext ();   // i tried both of the following UserTransaction lookups in trying 
to fix the problemtran = (UserTransaction) ctx.lookup 
("java:comp/UserTransaction");//tran = (UserTransaction) 
context.getUserTransaction();  
tran.begin();javax.resource.cci.ConnectionFactory conFac = 
(javax.resource.cci.ConnectionFactory)  ctx.lookup 
("java:comp/env/HPIARM");cx = 
conFac.getConnection();Interaction ix = cx.createInteraction 
();   // do 
work on ix, e.g. ix.execute();   // i've tried 
reordering the following two calls without effect.  tran.commit();  cx.close();  a servlet invokes the EJB to perform the above operations. the 
first time i run this body of code, everything works fine. that is, my 
resource adapter receives XAResource.start, XAResource.end, and 
XAResource.commit at the appropriate times. the second time, i get the 
exception listed below. it appears as if the TM still believes the 
XAResource is enlisted in the first transaction. this surprises me, 
because both XAResource.end and XAResource.commit were called during the first 
pass through the method. i believe we get the exception right after 
ManagedConnectionFactory has run matchManagedConnection and found a 
match.  any suggestions on how to debug this problem? i 
set the CONSOLE Threshold to TRACE in log4j.xml, which didn't provide any log 
messages that helped me diagnose the problem. i'm relatively new to jboss; 
it's certainly possible i missed a simple configuration step. the service 
file for the resource adapter was mostly copied from an example that shipped 
with jboss.  
thanks.  -mike  
exception from jboss's console: 
 2003-01-09 15:33:42,036 WARN 
[org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener] 
in Enlisting tx, illegal state: TransactionImpl:XidImpl [FormatId=257, 
GlobalId=fcmgrove//7, BranchQual=]2003-01-09 15:33:42,046 ERROR [STDERR] 
java.lang.IllegalStateException: Can't enlist - already a tx!2003-01-09 
15:33:42,046 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener.enlist(XATxConnectionManager.java:250)2003-01-09 
15:33:42,056 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.XATxConnect

[JBoss-user] can't enlist revisited - this time, with concurrent use of resource adapter

2003-01-10 Thread GROVE,MIKE (HP-FtCollins,ex1)



hi,

in a 
previous post with subject "[JBoss-user] "can't enlist" error on second pass 
through resource adapter" i described a problem i was havingwith multiple, 
non-concurrent invocations of a resource adapter via a stateless session 
bean. the responder's suggestion (swapping the order of 
UserTransaction.begin() and ConnectionFactory.getConnection()) got me past this 
problem. i still have an outstanding question out as to why this should be 
required, but we'll leave that as a separate thread.

my new 
problem is that i can't perform multiple, concurrent invocations of the resource 
adapter. during the 2nd call to ConnectionFactory.getConnection(), i get 
the "Can't enlist - already a tx!" error. in case it's helpful, this is 
the same error i got before i flipped the order of UserTransaction.begin() and 
ConnectionFactory.getConnection().

i put some 
comments in the EJB method that invokes the resource adapter to help me track 
down what state caused the problem. i also threw in a sleep call to assist 
as well.

same 
environment as in my previous post, which i'll repeat here:

i'm using 
jboss 3.0.4 with tomcat 4.1.12. my jdk is 1.3.1.06. platform is w2kp 
sp3. the resource adapter supports XA. res-sharing-scope is set to 
Unshareable in the ejb-jar.xml file of the EJB that uses the resource 
adapter.

this use 
case works fine under oc4j 9.0.3 and TeS 7.3.

any 
assistance would be appreciated. i'm trying to understand the 
feasibility/cost of a port of our resource adapter to jboss - an inability to 
use the resource adapter in a concurrent fashion would likely prevent us from 
using jboss.

thanks.

-mike

ejb code 
snippets:

javax.resource.cci.ConnectionFactory conFac 
= (javax.resource.cci.ConnectionFactory) 
ctx.lookup 
("java:comp/env/HPIARM");System.out.println("getting 
connection");cx = 
conFac.getConnection();System.out.println("got 
connection");
tran = (UserTransaction) 
context.getUserTransaction();
System.out.println("beginning 
transaction");tran.begin();System.out.println("begun 
transaction");

try { 
Thread.sleep(5000);}catch (InterruptedException 
ie) { }
 // do 
some work on cs via Interaction interface
 tran.commit(); 
System.out.println("commited transaction");

cx.close(); 
System.out.println("closed connection");


output in 
server.log:

2003-01-10 13:31:18,286 INFO [STDOUT] 
getting connection2003-01-10 13:31:18,286 INFO [STDOUT] got 
connection2003-01-10 13:31:18,286 INFO [STDOUT] beginning 
transaction2003-01-10 13:31:18,306 INFO [STDOUT] begun 
transaction2003-01-10 13:31:18,406 INFO [STDOUT] getting 
connection2003-01-10 13:31:18,436 WARN 
[org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener] 
in Enlisting tx, illegal state: TransactionImpl:XidImpl [FormatId=257, 
GlobalId=fcmgrove//8, BranchQual=]2003-01-10 13:31:18,436 ERROR [STDERR] 
java.lang.IllegalStateException: Can't enlist - already a tx!2003-01-10 
13:31:18,446 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener.enlist(XATxConnectionManager.java:250)2003-01-10 
13:31:18,446 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.XATxConnectionManager.managedConnectionReconnected(XATxConnectionManager.java:202)2003-01-10 
13:31:18,446 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:534)2003-01-10 
13:31:18,466 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:814)2003-01-10 
13:31:18,466 ERROR [STDERR] at 
com.hp.ov.activator.resmgr.connector.HPIAConnectionFactory.getConnection(Unknown 
Source)2003-01-10 13:31:18,476 ERROR [STDERR] at 
com.hp.ov.activator.resmgr.ejb.ServiceActivationBean.executeService(Unknown 
Source)2003-01-10 13:31:18,476 ERROR [STDERR] at 
java.lang.reflect.Method.invoke(Native Method)2003-01-10 13:31:18,476 ERROR 
[STDERR] at 
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)2003-01-10 
13:31:18,486 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)2003-01-10 
13:31:18,486 ERROR [STDERR] at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)2003-01-10 
13:31:18,486 ERROR [STDERR] at 
org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)2003-01-10 
13:31:18,496 ERROR [STDERR] at 
org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)2003-01-10 
13:31:18,496 ERROR [STDERR] at 
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)2003-01-10 
13:31:18,496 ERROR [STDERR] at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)2003-01-10 
13:31:18,496 ERROR [STDERR] at 

[JBoss-user] can't enlist error on second pass through resource adapter

2003-01-09 Thread GROVE,MIKE (HP-FtCollins,ex1)



jboss 
gurus,

i'm trying 
to port a resource adapter to jboss to investigate the feasibility/cost of using 
this resource adapter with jboss. i'm using jboss 3.0.4 with tomcat 
4.1.12. my jdk is 1.3.1.06. platform is w2kp sp3. the resource 
adapter supports XA. res-sharing-scope is set to Unshareable in the 
ejb-jar.xml file of the EJB that uses the resource adapter.

the resource 
adapter worked fine in the following use case with both oracle's 9.0.3 oc4j and 
HP Bluestone's TeS 7.3. the use case is as follows: 

i have a 
stateless session bean that begins a BMT, looks up the resource adapter, 
performs some work on it (via the Interaction interface), closes the connection, 
and commits the transaction. e.g.:

InitialContext ctx = new InitialContext 
();

// i tried both of the following 
UserTransaction lookups in trying to fix the problemtran 
= (UserTransaction) ctx.lookup 
("java:comp/UserTransaction");//tran = (UserTransaction) 
context.getUserTransaction();
tran.begin();javax.resource.cci.ConnectionFactory 
conFac = 
(javax.resource.cci.ConnectionFactory) 
ctx.lookup ("java:comp/env/HPIARM");cx = 
conFac.getConnection();Interaction ix = cx.createInteraction 
(); 
// do work on ix, e.g. 
ix.execute();

// i've tried reordering the following two 
calls without effect.
 
tran.commit();
cx.close();

a servlet 
invokes the EJB to perform the above operations. the first time i run this 
body of code, everything works fine. that is, my resource adapter receives 
XAResource.start, XAResource.end, and XAResource.commit at the appropriate 
times. the second time, i get the exception listed below. it appears 
as if the TM still believes the XAResource is enlisted inthe 
firsttransaction. this surprises me, because both XAResource.end and 
XAResource.commit were called during the first pass through the method. i 
believe we get the exception right after ManagedConnectionFactory has run 
matchManagedConnection and found a match.

any 
suggestions on how to debug this problem? i set the CONSOLE Threshold to 
TRACEin log4j.xml, which didn't provide any log messages that helped me 
diagnose the problem. i'm relatively new to jboss; it's certainly possible 
i missed a simple configuration step. the service file for the resource 
adapter was mostly copied from an example that shipped with 
jboss.

thanks.

-mike

exception 
from jboss's console:

2003-01-09 15:33:42,036 WARN 
[org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener] 
in Enlisting tx, illegal state: TransactionImpl:XidImpl [FormatId=257, 
GlobalId=fcmgrove//7, BranchQual=]2003-01-09 15:33:42,046 ERROR [STDERR] 
java.lang.IllegalStateException: Can't enlist - already a tx!2003-01-09 
15:33:42,046 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener.enlist(XATxConnectionManager.java:250)2003-01-09 
15:33:42,056 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.XATxConnectionManager.managedConnectionReconnected(XATxConnectionManager.java:202)2003-01-09 
15:33:42,066 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:534)2003-01-09 
15:33:42,076 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:814)2003-01-09 
15:33:42,086 ERROR [STDERR] at 
com.hp.ov.activator.resmgr.connector.HPIAConnectionFactory.getConnection(Unknown 
Source)2003-01-09 15:33:42,096 ERROR [STDERR] at 
com.hp.ov.activator.resmgr.ejb.ServiceActivationBean.executeService(Unknown 
Source)2003-01-09 15:33:42,096 ERROR [STDERR] at 
java.lang.reflect.Method.invoke(Native Method)2003-01-09 15:33:42,106 ERROR 
[STDERR] at 
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)2003-01-09 
15:33:42,116 ERROR [STDERR] at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)2003-01-09 
15:33:42,126 ERROR [STDERR] at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)2003-01-09 
15:33:42,136 ERROR [STDERR] at 
org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)2003-01-09 
15:33:42,136 ERROR [STDERR] at 
org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)2003-01-09 
15:33:42,146 ERROR [STDERR] at 
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)2003-01-09 
15:33:42,156 ERROR [STDERR] at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)2003-01-09 
15:33:42,166 ERROR [STDERR] at 
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)2003-01-09 
15:33:42,166 ERROR [STDERR] at 
org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)2003-01-09 
15:33:42,176 ERROR [STDERR] at