1 Reply Latest reply on Aug 25, 2002 1:23 AM by David Jencks

    how to associate connection handle to managedconnection?

    satria Newbie

      hi all,

      i am a newbie in jboss app server, i have a problem connecting to mySQL with jboss 3.0 with jetty, previously worked fine using jboss 2.4.4_tomcat-4.0.1
      i dont know where to post this problem.

      i have a jsp login page, which will call a bean which will call an EJB which will call another EJB who is reponsible to do database manipulation.

      when it tried to check if the user exist, the connection to mySQL is ok, but when i tried to display the user detail (selecting another table) i got an exception:

      15:54:32,065 ERROR [STDERR] java.sql.SQLException: Connection handle is not curr
      ently associated with a ManagedConnection
      15:54:32,075 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.local.LocalCo
      nnection.checkStatus(LocalConnection.java:774)
      15:54:32,085 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.local.LocalCo
      nnection.prepareStatement(LocalConnection.java:188)
      15:54:32,095 ERROR [STDERR] at my.com.nsys.virtuapresence.ejb.ncompass.NComp
      assEJB.getMsgInfo(NCompassEJB.java:350)
      15:54:32,115 ERROR [STDERR] at my.com.nsys.virtuapresence.ejb.ncompass.NComp
      assEJB.bindParameter(NCompassEJB.java:290)
      15:54:32,125 ERROR [STDERR] at my.com.nsys.virtuapresence.ejb.ncompass.NComp
      assEJB.doSendReceive(NCompassEJB.java:224)
      15:54:32,135 ERROR [STDERR] at java.lang.reflect.Method.invoke(Native Method
      )
      15:54:32,155 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$Conta
      inerInterceptor.invoke(StatelessSessionContainer.java:664)
      15:54:32,165 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedCo
      nnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      15:54:32,175 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanc
      eInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      15:54:32,195 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.i
      nvokeNext(AbstractTxInterceptor.java:96)
      15:54:32,205 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWit
      hTransactions(TxInterceptorCMT.java:167)
      15:54:32,215 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
      (TxInterceptorCMT.java:61)
      15:54:32,225 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.inv
      oke(SecurityInterceptor.java:129)
      15:54:32,245 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(L
      ogInterceptor.java:166)
      15:54:32,255 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.invok
      e(StatelessSessionContainer.java:313)
      15:54:32,265 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java
      :705)
      15:54:32,275 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MB
      eanServerImpl.java:491)
      15:54:32,295 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invok
      e(LocalInvoker.java:98)
      15:54:32,305 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invok
      e(InvokerInterceptor.java:102)
      15:54:32,315 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke
      (TransactionInterceptor.java:73)
      15:54:32,325 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(Se
      curityInterceptor.java:76)
      15:54:32,345 ERROR [STDERR] at org.jboss.proxy.ejb.StatelessSessionIntercept
      or.invoke(StatelessSessionInterceptor.java:111)
      15:54:32,355 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(Client
      Container.java:76)
      15:54:32,375 ERROR [STDERR] at $Proxy105.doSendReceive(Unknown Source)
      15:54:32,375 ERROR [STDERR] at my.com.nsys.virtuapresence.ejb.customer.Custo
      merEJB.getCustomer(CustomerEJB.java:428)
      15:54:32,385 ERROR [STDERR] at java.lang.reflect.Method.invoke(Native Method
      )
      15:54:32,395 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$Conta
      inerInterceptor.invoke(StatelessSessionContainer.java:664)
      15:54:32,415 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedCo
      nnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      15:54:32,425 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanc
      eInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      15:54:32,435 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.i
      nvokeNext(AbstractTxInterceptor.java:96)
      15:54:32,445 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWit
      hTransactions(TxInterceptorCMT.java:167)
      15:54:32,465 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
      (TxInterceptorCMT.java:61)
      15:54:32,475 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.inv
      oke(SecurityInterceptor.java:129)
      15:54:32,485 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(L
      ogInterceptor.java:166)
      15:54:32,505 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.invok
      e(StatelessSessionContainer.java:313)
      15:54:32,515 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java
      :705)
      15:54:32,525 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MB
      eanServerImpl.java:491)
      15:54:32,535 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invok
      e(LocalInvoker.java:98)
      15:54:32,555 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invok
      e(InvokerInterceptor.java:102)
      15:54:32,565 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke
      (TransactionInterceptor.java:73)
      15:54:32,575 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(Se
      curityInterceptor.java:76)
      15:54:32,595 ERROR [STDERR] at org.jboss.proxy.ejb.StatelessSessionIntercept
      or.invoke(StatelessSessionInterceptor.java:111)
      15:54:32,606 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(Client
      Container.java:76)
      15:54:32,616 ERROR [STDERR] at $Proxy121.getCustomer(Unknown Source)
      15:54:32,626 ERROR [STDERR] at my.com.nsys.virtuapresence.web.CustomerBean.g
      etCustomer(CustomerBean.java:208)
      15:54:32,636 ERROR [STDERR] at org.apache.jsp.MYnLiven_0005fmain$jsp._jspSer
      vice(MYnLiven_0005fmain$jsp.java:556)
      15:54:32,656 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service
      (HttpJspBase.java:107)
      15:54:32,666 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
      rvlet.java:853)
      15:54:32,676 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet$JspServl
      etWrapper.service(JspServlet.java:201)
      15:54:32,686 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJ
      spFile(JspServlet.java:381)
      15:54:32,706 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(
      JspServlet.java:473)
      15:54:32,726 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
      rvlet.java:853)
      15:54:32,736 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHolder.handl
      e(ServletHolder.java:371)
      15:54:32,746 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHandler.hand
      le(ServletHandler.java:607)
      15:54:32,756 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpConte
      xt.java:1387)
      15:54:32,776 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpConte
      xt.java:1326)
      15:54:32,786 ERROR [STDERR] at org.mortbay.http.HttpServer.service(HttpServe
      r.java:757)
      15:54:32,796 ERROR [STDERR] at org.jboss.jetty.Jetty.service(Jetty.java:527)

      15:54:32,806 ERROR [STDERR] at org.mortbay.http.HttpConnection.service(HttpC
      onnection.java:742)
      15:54:32,826 ERROR [STDERR] at org.mortbay.http.HttpConnection.handleNext(Ht
      tpConnection.java:915)
      15:54:32,836 ERROR [STDERR] at org.mortbay.http.HttpConnection.handle(HttpCo
      nnection.java:757)
      15:54:32,846 ERROR [STDERR] at org.mortbay.http.SocketListener.handleConnect
      ion(SocketListener.java:151)
      15:54:32,856 ERROR [STDERR] at org.mortbay.util.ThreadedServer.handle(Thread
      edServer.java:287)
      15:54:32,876 ERROR [STDERR] at org.mortbay.util.ThreadPool$JobRunner.run(Thr
      eadPool.java:715)
      15:54:32,886 ERROR [STDERR] at java.lang.Thread.run(Thread.java:484)
      15:54:32,896 INFO [STDOUT] CustomerBean.getCustomer()::Exception: Thu Aug 22 15
      :54:32 SGT 2002 CustomerEJB.getCustomer() - Exception:
      Thu Aug 22 15:54:32 SGT 2002 NCompassEJB.bindParameter() - Exception: Thu Aug
      22 15:54:32 SGT 2002 NCompassEJB.getMsgInfo() - SQLException: Connection hand
      le is not currently associated with a ManagedConnection

      my questions are:
      1. what is the difference between XADataSource (used in jboss 2.4.X) and LocalTX (used in jboss 3.0)? and does mySQL database support both actually?

      2. my code to connect to mySQL is as simple as this:
      ic = new InitialContext();
      ds = (DataSource)ic.lookup(MessageConstants.DB_NAME);
      conn = ds.getConnection();
      but the error said my connection is not associated with ManagedConnection, how to associate it?

      3. last but not least, of course how to solve my problem, it's been days... :(

      many thanks,

      .satria.

        • 1. Re: how to associate connection handle to managedconnection?
          David Jencks Master

          my questions are:
          1. what is the difference between XADataSource (used in jboss 2.4.X)
          The XADataSourceImpl in jboss 2.4 is an unfortunate workaround to adapt non xa drivers so they can be (sort of) used in jboss.
          and LocalTX (used in jboss 3.0)?
          The Local Tx jca jdbc wrapper is a spec compliant way to use non xa jdbc drivers in an app server.
          and does mySQL database support both actually?
          mysql supports at most local (jdbc 1) transactions. It does not support xa semantics.

          2. my code to connect to mySQL is as simple as this:
          ic = new InitialContext();
          ds = (DataSource)ic.lookup(MessageConstants.DB_NAME);
          conn = ds.getConnection();
          but the error said my connection is not associated with ManagedConnection, how to associate it?

          That should work. This is not the code that has the error, however. Are you holding the connection over calls to your ejb?

          If your ejb implements the equals and hashCode methods you should get the cvs version or wait for 3.0.2 or 3.2, there was a recently fixed bug in this case.

          3. last but not least, of course how to solve my problem, it's been days... :(

          If that is not the problem you need to provide more of your code.