2 Replies Latest reply on Jan 31, 2012 2:31 AM by atulkaushal

    JBoss 5.1.0 GA connection closing issue

    atulkaushal

      Hi,

      I am using Jboss 5.1.0 GA. I am explicitly closing connection in finally block but it throws connection error.

      After closing connection, i inspect the connection object it still contains proxy.

       

      Code:

       

      try{

        daoFactory = DAOConfigFactory.getInstance().getDAOFactory(appName);

        conn = daoFactory.getConnection();

        com.dhtmlx.connector.                            GridConnector connector = null;

                                              connector = new GridConnector(conn, DBType.Oracle);

                                    }

      catch (Exception ex)

                          {

      //catch exception here

                          }

                          finally

                          {

                                    try

                                    {

                                              if(conn != null)

                                              {

                                                        daoFactory.closeConnection(conn);

                                              }

                                    }

                                    catch (DAOException e)

                                    {

        //catch exception here

                                    }

                          }

       

       

      Exception:

       

      10:42:55,059 INFO  [CachedConnectionManager] Closing a connection for you.  Please close them yourself: org.jboss.resource.adapter.jdbc.jdk5.WrappedConnectionJDK5@51e33cb7

      java.lang.Throwable: STACKTRACE

              at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:278)

              at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:524)

              at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)

              at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)

              at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)

              at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)

              at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)

              at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:40)

              at $Proxy299.setAutoCommit(Unknown Source)

              at edu.wustl.dao.connectionmanager.ConnectionManager.newSession(ConnectionManager.java:203)

              at edu.wustl.dao.connectionmanager.ConnectionManager.getConnection(ConnectionManager.java:220)

              at edu.wustl.dao.daofactory.DAOFactory.getConnection(DAOFactory.java:466)

              at edu.wustl.catissuecore.action.LoadGridServlet.configure(LoadGridServlet.java:92)

              at com.dhtmlx.connector.ConnectorServlet.doGet(ConnectorServlet.java:28)

              at edu.wustl.catissuecore.action.LoadGridServlet.doGet(LoadGridServlet.java:140)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

       

       

      Any Pointers will be appreciated.

       

       

      Thanks,

      Atul

        • 1. Re: JBoss 5.1.0 GA connection closing issue
          wdfink

          You should try 'conn.close()' if you have a pooled connection of JBoss.

           

          The INFO message is a hint from the container that you have to call connection.close() to inform the container that the connection is not longer in use, it does not close the connection physicaly because after finishing the invocation this connection will be given back to pool.

           

          BTW what DAO... implementation is?

          • 2. Re: JBoss 5.1.0 GA connection closing issue
            atulkaushal

            Thanks for the reply.

             

            The closeConnection method of DAOFactory is doing the same thing.

             

            Method definition:

             

            public void closeConnection(Connection connObj) throws DAOException

                      {

                                try

                                {

                                          connObj.close();

                                }

                                catch (Exception excp)

                                {

                                          logger.error(excp.getMessage(), excp);

                                }

                      }