1 Reply Latest reply on May 2, 2007 5:09 PM by Sergio Barreros

    Jboss complaining about jdbc connections not being closed

    Sergio Barreros Newbie

      Hello, I have a session ejb where I explicitly open and close a connection to my database, yet when I call that ejb and a result is returned the server complains about my connection not being closed.
      Here is my EJB

      userObj usr = new userObj();
      if (userid.equals(null) | userpasswd.trim().equals("")) {
      return null;
      }
      String sql = "select * from users " +
      "where userid = '" + userid + "' " +
      "and userpasswd = '" + userpasswd + "'";
      try {
      Context ctx = new InitialContext();
      DataSource ds = (DataSource)ctx.lookup("java:/support");
      Connection con = ds.getConnection();
      Statement stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery(sql);

      if (rs.next()) {
      usr.setEmail(Utils.convertNull(rs.getString("usremail")));
      usr.setClearance(Utils.convertNull(rs.getString("userclearance")));
      usr.setAcro(Utils.convertNull(rs.getString("useracro")));
      usr.setName(Utils.convertNull(rs.getString("username")));
      usr.setLname(Utils.convertNull(rs.getString("userlname")));
      } else {
      usr = null;
      }

      con.close();
      ctx.close();
      stmt.close();
      } catch (javax.naming.NamingException _ne) {
      System.out.println("DataSource: Naming Exception!");
      } catch (java.sql.SQLException _se) {
      System.out.println("SQL Exception: " + sql);
      } finally {

      return usr;
      }
      }

      AND here is part of the error message
      Thanks in advance for any help..

      16:44:43,918 INFO [CachedConnectionManager] Closing a connection for you. Plea
      se close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@3bbcfd

      java.lang.Throwable: STACKTRACE
      at org.jboss.resource.connectionmanager.CachedConnectionManager.register
      Connection(CachedConnectionManager.java:290)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateC
      onnection(BaseConnectionManager2.java:417)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$Connectio
      nManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(Wrapp
      erDataSource.java:88)
      at hd.ejb.HelpDeskBean.Login(HelpDeskBean.java:92)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

        • 1. Here is the complete error message
          Sergio Barreros Newbie

          16:44:43,918 INFO [CachedConnectionManager] Closing a connection for you. Plea
          se close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@3bbcfd

          java.lang.Throwable: STACKTRACE
          at org.jboss.resource.connectionmanager.CachedConnectionManager.register
          Connection(CachedConnectionManager.java:290)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateC
          onnection(BaseConnectionManager2.java:417)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2$Connectio
          nManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
          at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(Wrapp
          erDataSource.java:88)
          at hd.ejb.HelpDeskBean.Login(HelpDeskBean.java:92)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
          java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
          sorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
          at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
          tatelessSessionContainer.java:237)
          at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
          ke(CachedConnectionInterceptor.java:158)
          at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
          elessSessionInstanceInterceptor.java:169)
          at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidation
          Interceptor.java:63)
          at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
          rceptor.java:121)
          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
          torCMT.java:350)
          at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
          81)
          at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
          java:168)
          at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
          at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
          ryFinderInterceptor.java:136)
          at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:6
          48)
          at org.jboss.ejb.Container.invoke(Container.java:954)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
          java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
          sorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
          er.java:155)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
          java:264)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
          at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(Loca
          lInvoker.java:169)
          at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)

          at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerIntercepto
          r.java:209)
          at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
          a:195)
          at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
          java:61)
          at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:7
          0)
          at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessi
          onInterceptor.java:112)
          at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
          at $Proxy57.Login(Unknown Source)
          at com.utils.UserBeanJSF.Login(UserBeanJSF.java:77)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
          java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
          sorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)

          at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
          enerImpl.java:72)
          at javax.faces.component.UICommand.broadcast(UICommand.java:312)
          at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)

          at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:3
          81)
          at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicat
          ionPhase.java:75)
          at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
          icationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
          ilterChain.java:173)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
          lter.java:96)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
          icationFilterChain.java:202)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
          ilterChain.java:173)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
          alve.java:213)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
          alve.java:178)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
          yAssociationValve.java:175)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
          e.java:74)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
          ava:126)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
          ava:105)
          at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConne
          ctionValve.java:156)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
          ve.java:107)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
          a:148)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
          :869)
          at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
          rocessConnection(Http11BaseProtocol.java:664)
          at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
          int.java:527)
          at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWor
          kerThread.java:112)
          at java.lang.Thread.run(Thread.java:595)