0

我正在将我的 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

我不确定为什么会这样

我也阅读了文件

如果有人更早遇到这个问题,请告诉我。

提前致谢。

4

0 回答 0