5 Replies Latest reply on May 29, 2004 7:13 PM by adrian.brock

    when shutting down jboss 3.2.3, topic destroying failed

    alanc_yang

      When I shut down JBoss 3.2.3, there was exception encountered for destroying topic. I have the following code in MDB's ejbRemove
      public void ejbRemove() {
      ctx = null;
      try {
      if (session != null) session.close();
      if (conn != null) conn.close();
      } catch(JMSException e) {
      log.error("ejbRemove error", e);
      }
      }

      Can somebody tell me how to gracefully shuts MDB itself down and prevent this from happening?

      Thanks in advance.

      Alan
      ------------

      2004-05-28 17:14:57,707 ERROR [org.jboss.mq.server.jmx.Topic.testTopic] Destroying failed
      javax.jms.JMSException: The destination is being used.

        • 1. Re: when shutting down jboss 3.2.3, topic destroying failed

          Your post makes no sense. There is no topic delete in the context you post.

          • 2. Re: when shutting down jboss 3.2.3, topic destroying failed
            alanc_yang

            When I did 'ctrl + c' to stop jboss, the JMS seems to perform a close on the testTopic but failed. My question is how to gracefully shuts down the MDB that had the connection and session created for the testTopic that this kind of error won't happen when jboss is shuting down. So, I cut and paste the code from my MDB in ejbRemove to show you if there is anything that I should have done in that routine. Other than ejbRemove, I don't know anywhere else to look for things that a graceful shutdown can be achieved.

            Let me try one more time to make myself clear, when jboss shuts down, how MDB can perform a graceful shutting down itself so that the JMSDestinationManager.closeDestination won't encounter the error as listed in the following.

            Hope this makes sense now.
            Thank you.

            Alan

            ---------



            2004-05-29 09:56:57,485 ERROR [org.jboss.mq.server.jmx.Topic.testTopic] Destroying failed
            javax.jms.JMSException: The destination is being used.
            at org.jboss.mq.server.JMSDestinationManager.closeDestination(JMSDestinationManager.java:807)
            at org.jboss.mq.server.jmx.DestinationMBeanSupport.destroyService(DestinationMBeanSupport.java:142)
            at org.jboss.system.ServiceMBeanSupport.destroy(ServiceMBeanSupport.java:284)
            at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
            at $Proxy14.destroy(Unknown Source)
            at org.jboss.system.ServiceController.destroy(ServiceController.java:531)
            at org.jboss.system.ServiceController.destroy(ServiceController.java:522)
            at org.jboss.system.ServiceController.destroy(ServiceController.java:522)
            at org.jboss.system.ServiceController.destroy(ServiceController.java:522)
            at org.jboss.system.ServiceController.destroy(ServiceController.java:522)
            at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
            at $Proxy4.destroy(Unknown Source)
            at org.jboss.deployment.SARDeployer.destroy(SARDeployer.java:408)
            at org.jboss.deployment.MainDeployer.destroy(MainDeployer.java:522)
            at org.jboss.deployment.MainDeployer.undeploy(MainDeployer.java:473)
            at org.jboss.deployment.MainDeployer.shutdown(MainDeployer.java:359)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
            at org.jboss.system.server.ServerImpl$ShutdownHook.shutdownDeployments(ServerImpl.java:849)
            at org.jboss.system.server.ServerImpl$ShutdownHook.shutdown(ServerImpl.java:824)
            at org.jboss.system.server.ServerImpl$ShutdownHook.run(ServerImpl.java:812)

            • 3. Re: when shutting down jboss 3.2.3, topic destroying failed

              Ok,

              Your MDB should already have been stopped by the time it removes the topic.
              You have something else subscribed to the topic.

              In any case this works differently in 3.2.4 - it no longer throws that exception (which
              isn't very useful anyway).

              P.S. Holding one connection open per MDB instance is very inefficient. Use the
              resource adapter to pool connections instead.

              • 4. Re: when shutting down jboss 3.2.3, topic destroying failed
                alanc_yang

                I should only have the connection and session created. Not sure what you mean by I have something else subscribed to the topic.

                In any case, I have a follow up question for the 3.2.3 case where the exception was thrown: will this kind of failure impact the 'redeployment' of the MDB? For example, I copy over my .ear file that has the MDB in there onto the deployment directory while JBoss is running?

                • 5. Re: when shutting down jboss 3.2.3, topic destroying failed

                  The message says you are trying to undeploy the topic at shutdown,
                  but you still have subscribers waiting for a message (who cares?).

                  From 3.2.4 it will throw off any subscribers, in fact it does the same thing
                  in 3.2.3 but less eligantly - hence your stacktrace.