6 Replies Latest reply on Oct 28, 2002 11:45 PM by Ron

    "associateConnection" problem

    Tim Fox Master

      I'm using XA transactions with JBoss 3.0.0 (tried both on final and 3.0 cvs version).
      And I'm getting the following exception when (I think) my transaction spans more than one bean:

      javax.resource.ResourceException: associateConnection not supported
      at org.jboss.resource.adapter.jdbc.BaseManagedConnection.associateConnection(BaseManagedConnection.java:91)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnect(BaseConnectionManager2.java:594)
      at org.jboss.resource.connectionmanager.CachedConnectionManager.reconnect(CachedConnectionManager.java:331)
      at org.jboss.resource.connectionmanager.CachedConnectionManager.popMetaAwareObject(CachedConnectionManager.java:153)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:190)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:152)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:69)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:282)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:183)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:296)
      at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
      at $Proxy117.getId(Unknown Source)

      On searching for this bug, it appears its a known bug and is fixed in the local transaction wrapper, although I couldn't see any mention of it having been fixed in the xa wrapper, and it certainly still seems to be there.

      Can anyone shed any light on to the status of this, since it's causing us a great deal of problems at the moment.

      Thanks.

        • 1. Re: "associateConnection" problem
          David Jencks Master

          hmmm. It's hard to remember what version has which fixes. If you use a cvs version, this should only be a problem if you are holding connection (handles) over method boundaries. As I recall at least 3.0.0 has this problem also if you hold a connection over a call to another ejb.

          In any case if you always

          Connection c = ds.getConnection();
          try {
          //do work but don't call any other ejbs
          }
          finally {
          c.close()
          }

          you should be ok. If not let me know.

          • 2. Re: "associateConnection" problem
            Tim Fox Master

            Hi David-

            unfortunately i don't have any control over when and how the connections are got and how long they're held for, since I'm using mvcsoft 3rd pary cmp tool (actually bmp code generator).

            if i could help in looking into finding a solution to this, i would be more than happy to do so, as this is very important to us...

            • 3. Re: "associateConnection" problem
              David Jencks Master

              MVCSoft works with jboss 2.4.x, which did not support holding connections over tx boundaries. Therefore I suspect moving to a more recent jboss 3 version will help you. At some point after 3.0.0 I removed the code that forced an associate connection call when you call another ejb while holding a connection. I'm not sure if this made it into 3.0.1.

              For a more comprehensive fix, the jca xa jdbc wrapper needs to be replaced, see the "todo" item on this.

              • 4. Re: "associateConnection" problem
                Dieter Cailliau Newbie

                is this problem fixed yet? i'm using jboss-3.0.0_tomcat-4.0.3 and i have the same trouble: one distributed xa over 2 ejb's -> ResourceException

                • 5. Re: "associateConnection" problem
                  David Jencks Master

                  The xa wrapper is replaced in cvs head, and it can associate connection handles. I'm hoping for a little more feedback that it works before I backport it to 3.2.

                  However, if you follow the advice I gave earlier of closing handles before calling another ejb or returning from your call, I'd expect there to be no problems even with jboss 3.0.0. There is most likely improvement by 3.0.2.

                  • 6. Re: "associateConnection" problem
                    Ron Newbie

                    Hi,

                    I am using JBoss 3.0.3 with CastorJDO and MSSQLServer. I installed the mssql-xa-service.xml from the examples and modified the rooms example found on this web site to with it.

                    The basic structure is that the ServiceBroker returns a reference to the ejb to the client. The client calls findModel which throws an objectNotfoundexception. Then the call to addModel throws the exception below.

                    The methods calls are proxied from the ejb to a ModelServiceDao member object on the EJB impl class. The Dao object instantiates a CastorHelper object that has
                    a castor JDO DataObjects member object.

                    Caused by: javax.resource.ResourceException: associateConnection not supported
                    at org.jboss.resource.adapter.jdbc.BaseManagedConnection.associateConnection(BaseManagedConnection.java:91)
                    at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnect(BaseConnectionManager2.java:594)
                    at org.jboss.resource.connectionmanager.CachedConnectionManager.reconnect(CachedConnectionManager.java:344)
                    at org.jboss.resource.connectionmanager.CachedConnectionManager.pushMetaAwareObject(CachedConnectionManager.java:140)
                    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:183)
                    at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:266)
                    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
                    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
                    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
                    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
                    at org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:380)
                    at org.jboss.ejb.Container.invoke(Container.java:712)
                    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                    at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
                    at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
                    at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
                    at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
                    at org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:117)
                    at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)


                    Any help is greatly appreciated.

                    Ron