Wildfly 9上的HornetQ实现

时间:2015-12-16 10:52:09

标签: java jboss jms wildfly wildfly-9

我正在将我的jboss从4.0.5迁移到Wildfly9,

技术: Wildfly 9 我的应用程序部署在localhost

但是当我尝试使用以下代码创建连接时,

import java.util.Map;

import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.api.jms.JMSFactoryType;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.jms.client.HornetQConnectionFactory;


Map<String, Object> connectionParams = new HashMap<String, Object>();
        connectionParams.put("port", "5445");
        connectionParams.put("host", "localhost");

        TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams);
        //
        HornetQConnectionFactory connectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration);
        try {
            connectionFactory.createConnection();
        } catch (JMSException e) {
            e.printStackTrace();
        }

我得到以下例外情况。

javax.jms.JMSException: Failed to create session factory
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:673)
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:112)
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:107)
    at Demo.main(Demo.java:176)
Caused by: HornetQNotConnectedException[errorType=NOT_CONNECTED message=HQ119007: Cannot connect to server(s). Tried with all available servers.]
    at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:905)
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:669)
    ... 3 more

我不确定为什么会发生这种情况

我还阅读了document

让我知道是否有人早些时候面对这个问题。

提前致谢。

0 个答案:

没有答案