4 Replies Latest reply on Jan 17, 2008 4:41 AM by ritesh163

    Problem in closing the connection to database?

    ritesh163

      Hello everyone,
      I am having problem in closing the database connection. Before I had used jboss-4.0.4.GA, where there was no problem in closing connection but now I am using jboss-4.2.2.GA which display problems in closing the database connection with the same project that was running fine in previous version. Can anyone tell me, what the problem is about?

      The error information is given below:

      ===============================================================================

      JBoss Bootstrap Environment

      JBOSS_HOME: E:\jboss-4.2.2.GA

      JAVA: C:\Program Files\Java\jdk1.5.0_12\bin\java

      JAVA_OPTS: -Dprogram.name=run.bat -server -Xms128m -Xmx512m -Dsun.rmi.dgc.cli
      ent.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

      CLASSPATH: C:\Program Files\Java\jdk1.5.0_12\lib\tools.jar;E:\jboss-4.2.2.GA\b
      in\run.jar

      ===============================================================================

      16:41:28,453 INFO [Server] Starting JBoss (MX MicroKernel)...
      16:41:28,468 INFO [Server] Release ID: JBoss [Trinity] 4.2.2.GA (build: SVNTag=
      JBoss_4_2_2_GA date=200710221139)
      16:41:28,484 INFO [Server] Home Dir: E:\jboss-4.2.2.GA
      16:41:28,484 INFO [Server] Home URL: file:/E:/jboss-4.2.2.GA/
      16:41:28,484 INFO [Server] Patch URL: null
      16:41:28,484 INFO [Server] Server Name: default
      16:41:28,484 INFO [Server] Server Home Dir: E:\jboss-4.2.2.GA\server\default
      16:41:28,484 INFO [Server] Server Home URL: file:/E:/jboss-4.2.2.GA/server/defa
      ult/
      16:41:28,484 INFO [Server] Server Log Dir: E:\jboss-4.2.2.GA\server\default\log

      16:41:28,484 INFO [Server] Server Temp Dir: E:\jboss-4.2.2.GA\server\default\tm
      p
      16:41:28,484 INFO [Server] Root Deployment Filename: jboss-service.xml
      16:41:30,234 INFO [ServerInfo] Java version: 1.5.0_12,Sun Microsystems Inc.
      16:41:30,234 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_12-b04
      ,Sun Microsystems Inc.
      16:41:30,234 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
      16:41:33,609 INFO [Server] Core system initialized
      16:41:49,593 INFO [WebService] Using RMI server codebase: http://Ritesh:8083/
      16:41:49,593 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resour
      ce:jboss-log4j.xml
      16:41:52,593 INFO [TransactionManagerService] JBossTS Transaction Service (JTA
      version) - JBoss Inc.
      16:41:52,593 INFO [TransactionManagerService] Setting up property manager MBean
      and JMX layer
      16:41:54,718 INFO [TransactionManagerService] Starting recovery manager
      16:41:55,687 INFO [TransactionManagerService] Recovery manager started
      16:41:55,687 INFO [TransactionManagerService] Binding TransactionManager JNDI R
      eference
      16:42:16,421 INFO [EJB3Deployer] Starting java:comp multiplexer
      16:42:18,984 INFO [STDOUT] no object for null
      16:42:18,984 INFO [STDOUT] no object for null
      16:42:19,062 INFO [STDOUT] no object for null
      16:42:19,093 INFO [STDOUT] no object for {urn:jboss:bean-deployer}supplyType
      16:42:19,109 INFO [STDOUT] no object for {urn:jboss:bean-deployer}dependsType
      16:42:26,671 INFO [NativeServerConfig] JBoss Web Services - Native
      16:42:26,671 INFO [NativeServerConfig] jbossws-native-2.0.1.SP2 (build=20071021
      0837)
      16:42:34,171 INFO [Embedded] Catalina naming disabled
      16:42:34,906 INFO [AprLifecycleListener] The Apache Tomcat Native library which
      allows optimal performance in production environments was not found on the java
      .library.path: C:\Program Files\Java\jdk1.5.0_12\bin;.;C:\WINDOWS\system32;C:\WI
      NDOWS;E:\oracle\orant\bin;C:\Program Files\Java\jdk1.5.0_12\bin;E:\oracle10\prod
      uct\10.2.0\client_1\bin;E:\oracle10g\product\10.2.0\client_2\bin;E:\oracle\produ
      ct\10.2.0\client_1\bin;C:\Program Files\Common Files\NetSarang;E:\oracle\ora92\b
      in;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\ULTRAE~1;
      C:\apache-ant-1.6.5\bin;E:\openssl\bin;C:\jboss-4.0.4.GA;C:\apache-ant-1.6.5\bin
      ;
      16:42:35,968 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0
      -8080
      16:42:38,921 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0
      -8443
      16:42:39,000 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-0.0.0.0-8009

      16:42:39,015 INFO [Catalina] Initialization processed in 4841 ms
      16:42:39,015 INFO [StandardService] Starting service jboss.web
      16:42:39,015 INFO [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA
      16:42:39,218 INFO [Catalina] Server startup in 206 ms
      16:42:39,500 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jboss-w
      eb.deployer/ROOT.war/
      16:42:41,046 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/
      http-invoker.sar/invoker.war/
      16:42:41,515 INFO [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../deploy/
      jbossws.sar/jbossws-context.war/
      16:42:42,234 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../
      deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
      16:42:45,546 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../dep
      loy/management/console-mgr.sar/web-console.war/
      16:42:47,140 INFO [MailService] Mail Service bound to java:/Mail
      16:42:47,734 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/jboss-ha-local-jdbc.rar
      16:42:47,781 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/jboss-ha-xa-jdbc.rar
      16:42:47,859 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/jboss-local-jdbc.rar
      16:42:47,937 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/jboss-xa-jdbc.rar
      16:42:48,078 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/jms/jms-ra.rar
      16:42:48,140 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/mail-ra.rar
      16:42:48,328 INFO [RARDeployment] Required license terms exist, view META-INF/r
      a.xml in .../deploy/quartz-ra.rar
      16:42:48,343 INFO [QuartzResourceAdapter] start quartz!!!
      16:42:49,156 INFO [SimpleThreadPool] Job execution threads will use class loade
      r of thread: main
      16:42:49,187 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
      16:42:49,187 INFO [RAMJobStore] RAMJobStore initialized.
      16:42:49,187 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzSchedule
      r' initialized from default resource file in Quartz package: 'quartz.properties'

      16:42:49,187 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
      16:42:49,187 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUS
      TERED started.
      16:42:49,593 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=ConnectionFactoryBinding,name=C24RA' to JNDI name 'java:C24RA'
      16:42:52,656 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
      16:42:53,843 INFO [A] Bound to JNDI name: queue/A
      16:42:53,843 INFO [B] Bound to JNDI name: queue/B
      16:42:53,843 INFO [C] Bound to JNDI name: queue/C
      16:42:53,843 INFO [D] Bound to JNDI name: queue/D
      16:42:53,843 INFO [ex] Bound to JNDI name: queue/ex
      16:42:54,187 INFO [testTopic] Bound to JNDI name: topic/testTopic
      16:42:54,203 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
      16:42:54,203 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic

      16:42:54,203 INFO [testQueue] Bound to JNDI name: queue/testQueue
      16:42:54,406 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.
      0.0:8093
      16:42:54,453 INFO [DLQ] Bound to JNDI name: queue/DLQ
      16:42:54,703 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
      16:42:54,828 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=DataSourceBinding,name=MysqlDS' to JNDI name 'java:MysqlDS'
      16:42:55,343 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=DataSourceBinding,name=OracleDS' to JNDI name 'java:OracleDS'
      16:42:55,359 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
      oss.jca:service=DataSourceBinding,name=OracleDS_gsm' to JNDI name 'java:OracleDS
      _gsm'
      16:42:56,000 INFO [EjbModule] Deploying NpgTxn
      16:42:56,656 INFO [ProxyFactory] Bound EJB Home 'NpgTxn' to jndi 'npg/NpgTxn'
      16:42:56,656 INFO [EJBDeployer] Deployed: file:/E:/jboss-4.2.2.GA/server/defaul
      t/deploy/npg_ejb.jar
      16:43:00,734 INFO [TomcatDeployer] deploy, ctxPath=/NPG, warUrl=.../tmp/deploy/
      tmp10362NPG-exp.war/
      16:43:01,328 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../dep
      loy/jmx-console.war/
      16:43:07,031 INFO [TomcatDeployer] deploy, ctxPath=/npgadmin, warUrl=.../tmp/de
      ploy/tmp10363npg-admin-exp.war/
      16:43:08,093 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808
      0
      16:43:08,140 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-844
      3
      16:43:08,250 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-0.0.0.0-8009
      16:43:08,484 INFO [Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBos
      s_4_2_2_GA date=200710221139)] Started in 1m:40s:0ms
      16:44:16,437 INFO [STDOUT] Active Users after creation::1
      16:44:41,828 INFO [STDOUT] test::servletConfigorg.apache.catalina.core.Standard
      WrapperFacade@20d10a
      16:44:41,859 INFO [STDOUT] Jboss home=E:\jboss-4.2.2.GA
      16:44:41,859 INFO [STDOUT] Current Date Time : 2008-01-16
      16:44:41,859 INFO [STDOUT] Log File =E:\jboss-4.2.2.GA\server\default\log\2008-
      01-16_npglog.txt
      16:45:21,156 INFO [STDOUT] sql::insert into example_table (TRAN_DATE,TRAN_I
      D,TRANS_INFO_ID) values(to_da
      te('01162008', 'MMddyyyy'),'000000000035','TI1601200800013')
      16:45:21,171 INFO [CachedConnectionManager] Closing a connection for you. Plea
      se close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@11b92e
      f
      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 com.nepasoft.npg.database.DBDataSource.getConnection(DBDataSource.jav
      a:63)
      at com.nepasoft.npg.dao.ISODAOImpl.getAccountIdentificationField(ISODAOI
      mpl.java:109)
      at com.nepasoft.npg.util.NPGUtils.constructAccountIdentificationField(NP
      GUtils.java:110)
      at com.nepasoft.npg.beans.ConstructISO8583Bean.construtISO8583Message(Co
      nstructISO8583Bean.java:92)
      at com.nepasoft.npg.controller.PostPayBillsFormEventHandler.process(Post
      PayBillsFormEventHandler.java:261)
      at com.nepasoft.npg.controller.PostAllFormsEventHandler.process(PostAllF
      ormsEventHandler.java:47)
      at com.nepasoft.npg.controller.MainController.processRequest(MainControl
      ler.java:93)
      at com.nepasoft.npg.controller.MainController.doPost(MainController.java
      :133)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:206)
      at com.nepasoft.npg.filters.AuthenticationFilter.doFilter(Authentication
      Filter.java:46)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
      lter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
      alve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
      alve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
      yAssociationValve.java:179)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
      torBase.java:524)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
      e.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
      ava:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
      ava:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
      onnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
      ve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
      a:262)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
      :844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
      ss(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
      6)
      at java.lang.Thread.run(Thread.java:595)
      16:45:21,203 INFO [CachedConnectionManager] Closing a connection for you. Plea
      se close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@347456

      Thank you.

        • 1. Re: Problem in closing the connection to database?
          jaikiran

           

          "ritesh163" wrote:

          Before I had used jboss-4.0.4.GA, where there was no problem in closing connection but now I am using jboss-4.2.2.GA which display problems in closing the database connection


          If you are referring to these messages:

          "ritesh163" wrote:

          16:45:21,171 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself:


          Then have a look at http://wiki.jboss.org/wiki/Wiki.jsp?page=WhatDoesTheMessageDoYourOwnHousekeepingMean

          • 2. Re: Problem in closing the connection to database?
            ritesh163

            Hello jaikiran,
            Thank you for the suggestion.
            But the main thing is that for the same project, jboss-4.0.4.GA doesn't display any error message while jboss-4.2.2.GA does. I am creating separate function for connection only which will return connection object to main function, the code is given below. And the return connection object is closed at main function. This function is called frequently, which is the main ponit.Will I have to create other function for closing this connection, making Connection as global variable? Please provide me with the suggestion that will solve this problem...

            The code for function is :

            public java.sql.Connection getConnection() throws java.sql.SQLException { java.sql.Connection connection = null;
            try {
            ......
            connection = dataSource.getConnection();

            }
            catch (Exception ex) {
            ex.printStackTrace();
            }
            return connection;
            }


            Thank you.

            • 3. Re: Problem in closing the connection to database?
              jaikiran

               

              "ritesh163" wrote:

              But the main thing is that for the same project, jboss-4.0.4.GA doesn't display any error message while jboss-4.2.2.GA does.


              In your two servers, check the value of "Debug" attribute for the CachedConnectionManager in %JBOSS_HOME%/server/< serverName>/deploy/jbossjca-service.xml file. I guess for JBoss-4.0.4GA its set to false where as it is true in your JBoss-4.2.2GA.
              <!--
               | The CachedConnectionManager is used partly to relay started UserTransactions to
               | open connections so they may be enrolled in the new tx.
               -->
               <mbean code="org.jboss.resource.connectionmanager.CachedConnectionManager"
               name="jboss.jca:service=CachedConnectionManager">
               <depends optional-attribute-name="TransactionManagerServiceName">jboss:service=TransactionManager</depends>
              
               <!-- Enable connection close debug monitoring -->
               <attribute name="Debug">true</attribute>
              
               </mbean>



              "ritesh163" wrote:

              Will I have to create other function for closing this connection


              Any connection that is opened needs to be closed, after its use. If you leave the connection open forever, then it will lead to a connection leak. The message that JBoss logs is an indication that you are not closing the connection.



              • 4. Re: Problem in closing the connection to database?
                ritesh163

                 

                In your two servers, check the value of "Debug" attribute for the CachedConnectionManager in %JBOSS_HOME%/server/< serverName>/deploy/jbossjca-service.xml file. I guess for JBoss-4.0.4GA its set to false where as it is true in your JBoss-4.2.2GA.


                I checked both server but I don't find any difference, both are set to true.
                Can I declare Connection as global variable and create separate close function? as that of getConnection function which I had discussed before. Will it effect the connection object or not, as it is called frequently?

                Thank you.