微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.naming.exception:JNDI查找失败与路由器通信时出错

如何解决javax.naming.exception:JNDI查找失败与路由器通信时出错

我在第一次连接到慰藉时就变得异常了

javax.naming.exception:JNDI查找失败与路由器通信时出错。感谢你的帮助。 Hashtable env =新的Hashtable (); //使用Solace JNDI初始上下文工厂 env.put(InitialContext.INITIAL_CONTEXT_FACTORY,“ com.solacesystems.jndi.solJNDIInitialContextFactory”);

    // assign Solace message router connection parameters
    env.put(InitialContext.PROVIDER_URL,host);
    env.put(Context.Security_PRINCIPAL,username + '@' + vpnName); // Formatted as user@message-vpn
    env.put(Context.Security_CREDENTIALS,password);

    // Create the initial context that will be used to lookup the JMS Administered Objects.
    InitialContext initialContext = new InitialContext(env);
    // Lookup the connection factory
    ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup(CONNECTION_FACTORY_JNDI_NAME);

    // Create connection to the Solace router
    Connection connection = connectionFactory.createConnection();

    // Create a non-transacted,client ACK session.
    Session session = connection.createSession(false,SupportedProperty.soL_CLIENT_ACKNowLEDGE);

    System.out.printf("Connected to the Solace Message VPN '%s' with client username '%s'.%n",vpnName,username);

    // Lookup the queue.
    Queue queue = (Queue) initialContext.lookup(QUEUE_JNDI_NAME);

    // From the session,create a consumer for the destination.
    MessageConsumer messageConsumer = session.createConsumer(queue);

解决方法

这意味着您的应用程序无法访问Solace PubSub +代理。请确保纯文本SMF服务在代理端启动,并且应用程序主机可以通过端口55555与代理进行通信。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。