Jboss AS7没有正常关闭

时间:2014-10-17 09:33:40

标签: java jboss jms jboss7.x

我正在使用以下命令在Windows 7上关闭Jboss AS7.2.0的独立实例。

%JBOSS_HOME%\bin\jboss-cli.bat --connect controller=10.10.54.85:9999 --commands=:shutdown

然而,与Jboss相关联的java进程没有被终止。我看到这个进程的线程转储显示一些挂起一段时间的线程,这些线程在相当长的时间(大约一个小时)后终止,然后进程自己完成。挂起的线程被命名为“JMX服务器连接超时”(我不确定这是唯一的罪魁祸首)。日志重复显示一些JMSEceptions,如下所示:

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

这是正确的根本原因吗?有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

如果没有看到您对JMS连接的使用,很难回答这个问题,但我建议您使用@PreDestroy方法注册EJB,以便优雅地终止所有连接:

@Singleton
public class JMSDummyHandlerBean 
{
    @PostConstruct
    public void init()
    {
        // Do your init here
    }

    @PreDestroy
    public void tearDown()
    {
        // This will be called on server shutdown so you can kill all the active connections
    }