I am using following command to shutdown a standalone instance of Jboss AS7.2.0 on windows 7.
%JBOSS_HOME%\bin\jboss-cli.bat --connect controller=10.10.54.85:9999 --commands=:shutdown
However the java process associated to Jboss is not getting terminated. I saw the thread dump of this process shows some threads hung for a while, which are terminated after quite a long time (about an hour) and then process gets finished on it's own. The hung threads are named "JMX server connection timeout" (I am not sure this is the only culprit). And the logs show some JMSEceptions repeatedly as follows:
2014-10-17 08:34:07.811 GMT+0000 <@> ERROR <@> [1425:Thread-364] <@> ProcessId:1252 <@> PID:0 <@> UID:12 <@> HttpSessionId: <@> com.mypkg.platform.framework.event <@> getTopicConnection <@> Failed to create TopicConnection <@>
javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jboss.naming.remote.client.InitialContextFactory from classloader ModuleClassLoader for Module "org.hornetq:main" from local module loader @68a9ae3e (finder: local module finder @5bee9e20 (roots: D:\jboss-as-7.2.0.Final\modules,D:\jboss-as-7.2.0.Final\modules\system\layers\base))
at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:681)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
at com.mypkg.platform.framework.event.Messenger.setupInitialContext(Messenger.java:915)
at com.mypkg.platform.framework.event.Messenger.getTopicConnectionFactory(Messenger.java:924)
at com.mypkg.platform.framework.event.Messenger.getTopicConnection(Messenger.java:1263)
at com.mypkg.platform.framework.event.Messenger.access$600(Messenger.java:103)
at com.mypkg.platform.framework.event.Messenger$ConnectionExceptionListener.onException(Messenger.java:1670)
at org.hornetq.jms.client.HornetQConnection$JMSFailureListener$1.run(HornetQConnection.java:697)
at java.lang.Thread.run(Thread.java:722)
2014-10-17 08:34:07.811 GMT+0000 <@> ERROR <@> [1425:Thread-364] <@> ProcessId:1252 <@> PID:0 <@> UID:12 <@> HttpSessionId: <@> com.mypkg.platform.framework.event <@> onException():TOPIC <@> Failed to establish Connection on attempt number: 30. Will retry after 10000 millis. Retry attempts remaining: 99970 <@>
javax.jms.JMSException: HornetQException[errorType=DISCONNECTED message=HQ119035: The connection was disconnected because of server shutdown]
at org.hornetq.jms.client.HornetQConnection$JMSFailureListener.connectionFailed(HornetQConnection.java:688)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.callSessionFailureListeners(ClientSessionFactoryImpl.java:963)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.failoverOrReconnect(ClientSessionFactoryImpl.java:740)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.handleConnectionFailure(ClientSessionFactoryImpl.java:580)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.access$100(ClientSessionFactoryImpl.java:85)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl$DelegatingFailureListener.connectionFailed(ClientSessionFactoryImpl.java:1674)
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.callFailureListeners(RemotingConnectionImpl.java:570)
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.fail(RemotingConnectionImpl.java:341)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl$CloseRunnable.run(ClientSessionFactoryImpl.java:1633)
at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:106)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: HornetQException[errorType=DISCONNECTED message=HQ119035: The connection was disconnected because of server shutdown]
... 5 more
Is this the correct root cause? Can somebody help me with this?