0

我正在尝试使用远程托管的 JNDI 和 HornetQ 服务器运行 HornetQ jms/queue 示例。

HornetQ 服务器在 10.0.10.102 上运行。在 10.0.2.62 上运行的客户端。服务器和客户端机器都是 Linux 机器。

我在客户端配置了client-jndi.properties文件如下: java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=jnp://10.0.10.102:1099 java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

我在 hornetq-beans.xml 配置文件中配置了 JNDI 设置,如下所示:

<bean name="JNDIServer" class="org.jnp.server.Main">
  <property name="namingInfo">
     <inject bean="Naming"/>
  </property>
  <property name="port">1099</property>
  <property name="bindAddress">10.0.10.102</property>
  <property name="rmiPort">1098</property>
  <property name="rmiBindAddress">10.0.10.102</property>
</bean>

我收到“拒绝连接”错误或客户端挂起查找 JNDI 服务,具体取决于我是否在服务器端 Linux 机器 (10.0.10.102) 上运行了“rmiregistry”。

如果不运行“rmiregistry”,我会在客户端收到以下错误:

 [java] javax.naming.CommunicationException: Could not obtain connection to any of these urls: 10.0.10.102:30199 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server /10.0.10.102:30199 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /10.0.10.102:30199 [Root exception is java.net.ConnectException: Connection refused]]]

当我在服务器主机上运行“rmiregistry”时,JNDI 查找挂起:

 [java] Jan 12, 2012 2:23:47 PM org.hornetq.common.example.HornetQExample getContext
 [java] INFO: using server0/client-jndi.properties for jndi

挂在这里...

知道我还需要做什么来为 JNDI 查找过程配置 JNDI 或我的 Java 环境吗?谢谢你。

4

1 回答 1

0

That example was written to be executed on the same terminal. The example is starting a remote server and the local server on the same box.

As you're running it remotely, you're creating some mechanism to start a remote server, so you're probably messing up some config.

I don't have enough information as to how you are starting the server, so I can't really answer your question right now. I will try to help you if you provide more information on how you're starting the server and what configuration changes are you making.

I would recommend you to read the Netty/remoting configuration chapter of HornetQ.

As for Netty here I just think you're changing the wrong file since

于 2012-01-13T23:40:52.877 回答