reordering did fix the problem, thanks.  however, shouldn't my previous ordering have worked as well?  i would expect that in 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 that swapping 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 AM
To: [EMAIL PROTECTED]
Subject: Antwort: [JBoss-user] "can't enlist" error on second pass through resource adapter


First 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 adapter



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 problem
 tran = (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.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 org.jboss.ejb.Container.invoke(Container.java:712)
2003-01-09 15:33:42,176 ERROR [STDERR]  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
2003-01-09 15:33:42,196 ERROR [STDERR]  at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
2003-01-09 15:33:42,196 ERROR [STDERR]  at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)

2003-01-09 15:33:42,206 ERROR [STDERR]  at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
2003-01-09 15:33:42,216 ERROR [STDERR]  at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
2003-01-09 15:33:42,226 ERROR [STDERR]  at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
2003-01-09 15:33:42,226 ERROR [STDERR]  at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
2003-01-09 15:33:42,236 ERROR [STDERR]  at $Proxy16.executeService(Unknown Source)
2003-01-09 15:33:42,236 ERROR [STDERR]  at com.hp.ov.activator.deployment.servlet.component.ActivateAction.execute(Unknown Source)
2003-01-09 15:33:42,246 ERROR [STDERR]  at com.hp.ov.activator.deployment.servlet.DeployerServlet.doPost(Unknown Source)
2003-01-09 15:33:42,256 ERROR [STDERR]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
2003-01-09 15:33:42,266 ERROR [STDERR]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
2003-01-09 15:33:42,276 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
2003-01-09 15:33:42,276 ERROR [STDERR]  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
2003-01-09 15:33:42,286 ERROR [STDERR]  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
2003-01-09 15:33:42,296 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
2003-01-09 15:33:42,306 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
2003-01-09 15:33:42,306 ERROR [STDERR]  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
2003-01-09 15:33:42,316 ERROR [STDERR]  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
2003-01-09 15:33:42,326 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
2003-01-09 15:33:42,337 ERROR [STDERR]  at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
2003-01-09 15:33:42,337 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
2003-01-09 15:33:42,357 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
2003-01-09 15:33:42,357 ERROR [STDERR]  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
2003-01-09 15:33:42,367 ERROR [STDERR]  at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
2003-01-09 15:33:42,377 ERROR [STDERR]  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
2003-01-09 15:33:42,377 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
2003-01-09 15:33:42,387 ERROR [STDERR]  at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
2003-01-09 15:33:42,397 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
2003-01-09 15:33:42,407 ERROR [STDERR]  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
2003-01-09 15:33:42,407 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
2003-01-09 15:33:42,417 ERROR [STDERR]  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469)
2003-01-09 15:33:42,427 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
2003-01-09 15:33:42,437 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
2003-01-09 15:33:42,437 ERROR [STDERR]  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
2003-01-09 15:33:42,447 ERROR [STDERR]  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
2003-01-09 15:33:42,457 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
2003-01-09 15:33:42,467 ERROR [STDERR]  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
2003-01-09 15:33:42,467 ERROR [STDERR]  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
2003-01-09 15:33:42,477 ERROR [STDERR]  at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1040)
2003-01-09 15:33:42,487 ERROR [STDERR]  at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151)
2003-01-09 15:33:42,497 ERROR [STDERR]  at java.lang.Thread.run(Thread.java:479)

 
service file for resource adapter:

<?xml version="1.0" encoding="UTF-8"?>

<server>
  <mbean code="org.jboss.resource.connectionmanager.XATxConnectionManager"
         name="jboss.jca:service=XaTxCM,name=HPIA Connector">

      <depends>jboss.jca:service=RARDeployer</depends>

      <depends optional-attribute-name="ManagedConnectionFactoryName">
        <mbean code="org.jboss.resource.connectionmanager.RARDeployment"
               name="jboss.jca:service=XaTxDs,name=HPIA Connector">

     <depends optional-attribute-name="OldRarDeployment">
       jboss.jca:service=RARDeployment,name=HPIA Connector
    </depends>

     <attribute name="JndiName">HPIARM</attribute>
           <attribute name="ManagedConnectionFactoryProperties">
              <properties>

     <config-property>
           <config-property-name>Host</config-property-name>
           <config-property-type>java.lang.String</config-property-type>
           <config-property-value>localhost</config-property-value>
       </config-property>

        <config-property>
           <config-property-name>Port</config-property-name>
           <config-property-type>java.lang.String</config-property-type>
           <config-property-value>6667</config-property-value>
       </config-property>

        <config-property>
           <config-property-name>Classname</config-property-name>
           <config-property-type>java.lang.String</config-property-type>
           <config-property-value>com.hp.ov.activator.log.HPIALogger</config-property-value>
       </config-property>

        <config-property>
           <config-property-name>LogDirectory</config-property-name>
           <config-property-type>java.lang.String</config-property-type>
           <config-property-value>d:/</config-property-value>
       </config-property>

        <config-property>
           <config-property-name>LogLevel</config-property-name>
           <config-property-type>java.lang.String</config-property-type>
           <config-property-value>DEBUG2</config-property-value>
       </config-property>

        <config-property>
           <config-property-name>LogMaxEntries</config-property-name>
           <config-property-type>java.lang.String</config-property-type>
           <config-property-value>10000</config-property-value>
       </config-property>

        <config-property>
           <config-property-name>LogAllowStatistics</config-property-name>
           <config-property-type>java.lang.String</config-property-type>
           <config-property-value>TRUE</config-property-value>
       </config-property>

</properties>
           </attribute>

         </mbean>
     </depends>

      <depends optional-attribute-name="ManagedConnectionPool">
        <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool"
        name="jboss.jca:service=XaTxPool,name=HPIA Connector">

            <attribute name="MinSize">                 0</attribute>
           <attribute name="MaxSize">                50</attribute>
           <attribute name="BlockingTimeoutMillis">5000</attribute>
           <attribute name="IdleTimeoutMinutes">     15</attribute>
           <attribute name="Criteria">ByApplication</attribute>
        </mbean>
     </depends>

      <depends optional-attribute-name="CachedConnectionManager">
        jboss.jca:service=CachedConnectionManager
     </depends>

      <depends optional-attribute-name="JaasSecurityManagerService">
        jboss.security:service=JaasSecurityManager
     </depends>

      <attribute name="TransactionManager">
        java:/TransactionManager
     </attribute>
  </mbean>
</server>

Reply via email to