NoRouteToHostException / NoSuchHostException on remote JMX call

I am having problems with a JBoss 6 remote JMX call on a Centos 5.6 server. Previously, I could do this when running the same application on a Debian server.

./twiddle.sh --server=service:jmx:rmi:///jndi/rmi://SERVER:1090/jmxconnector invoke foo:service=bar baz Caused by: java.net.NoRouteToHostException: No route to host at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at java.net.Socket.<init>(Socket.java:375) at java.net.Socket.<init>(Socket.java:189) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595) 

The same call succeeds if I run it locally on the SERVER server. I opened port 1090 with iptables, and I can connect via telnet to SERVER: 1090. hostname -i returns the correct IP address.

I also tried to launch JBoss using -Djava.rmi.server.hostname=localhost . If I do this, I get another exception:

 Caused by: java.rmi.NoSuchObjectException: no such object in table at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142) at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source) at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2327) at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:279) at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248) at org.jboss.console.twiddle.Twiddle.createMBeanServerConnection(Twiddle.java:322) at org.jboss.console.twiddle.Twiddle.connect(Twiddle.java:331) at org.jboss.console.twiddle.Twiddle.access$400(Twiddle.java:60) at org.jboss.console.twiddle.Twiddle$1.getServer(Twiddle.java:217) 
+6
source share
2 answers

It turns out that in addition to port 1090, JMX / RMI also uses a dynamically allocated port that is blocked by a firewall. So, if appropriate, disable the firewall at all, otherwise it seems like an alternative (I haven't tried it yet):

http://olegz.wordpress.com/2009/03/23/jmx-connectivity-through-the-firewall/

+4
source

I have done this:

Update the activemq.xml file and specify rmiServerPort.

 <managementContext createConnector="true" connectorPort="SOME_PORT" rmiServerPort="SOME_OTHER" jmxDomainName="org.apache.activemq"/> 

Allow both ports by updating the iptables entry, restart activemq and work.

+1
source

Source: https://habr.com/ru/post/917088/


All Articles