0 Replies Latest reply on Apr 18, 2012 1:33 PM by Ori Kremer

    Dependency in Connection Manager

    Ori Kremer Newbie

      We are facing a problem with accessing the database during the shutdown phase.

      It looks like when our shutdown code tries to access the database - it is no longer available.

       

      Our application is deployed as an EAR that has a SAR module to handle startup and shutdown.

      We add our application specific startup and shutdown code in the corresponding MBean hooks.

       

      In JBoss 7.0.2 and 7.1.1 we're encountering an error that shutdown code attempting to access the database is failing due to the fact that the connection manager is closed:

       

      13:08:37,975 ERROR [org.jboss.as.service] JBAS017200: Failed to execute legacy service stop() method: java.lang.reflect.InvocationTargetException

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_01]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_01]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_01]

              at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_01]

              at org.jboss.as.service.AbstractService.invokeLifecycleMethod(AbstractService.java:52) [jboss-as-sar-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.as.service.StartStopService.stop(StartStopService.java:66) [jboss-as-sar-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:1911) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:1874) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_01]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_01]

              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_01]

      Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000451: The connection manager is shutdown: java:/org.test.NonSecureDS

              at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:137)

              at org.test.StartupService.updateStatus(StartupService.java:37)

              at org.test.StartupService.stop(StartupService.java:56)

              ... 11 more

      Caused by: javax.resource.ResourceException: IJ000451: The connection manager is shutdown: java:/org.test.NonSecureDS

              at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:321)

              at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)

              at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)

              at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)

              ... 13 more

       

       

      Is there a way to define a dependency so that the application would be stopped before connection manager?