I'm trying to install a JBoss AS 7 on a EC2 instance. Everything is working fine except JMX access.
My server has a LAN IP address wich is different from the IP address used to acces to the server. I've change the interfaces (management and public) to any-address.
I'm trying to access to JMX with the following code, using the public address :
String host = "ec2-100-20-180-80.compute-1.amazonaws.com"; int port = 1090; String urlString = System.getProperty("jmx.service.url", "service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi"); JMXServiceURL serviceURL = new JMXServiceURL(urlString); JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, null); MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
I get the following message :
Exception in thread "main" java.rmi.ConnectException: Connection refused to host: 10.190.70.10; nested exception is:
Of course, it cannot work as 10.190.70.10 is the local IP of my server.
I've tried to add some properties, but it didn't work.
How could I do to access to my server with JMX ?
in standalone.xml, depending on which interfaces you have set up in your interfaces section, try setting up these socket bindings
<socket-binding name="jmx-connector-registry" interface="management" port="1090"/>
<socket-binding name="jmx-connector-server" interface="management" port="1091"/>
to bind to an externally accessible interface
The only way I found to connect a jconsole to my JBoss AS 7 on EC2 to pass through a SOCKS proxy.
To start the proxy client :
ssh -vfND 6666 -i .amazon/aws1-sewatech-net.pem firstname.lastname@example.org
To launch jconsole :
jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=6666 aws.sewatech.net:1090
For french speaking people, I described the solution in my personal wiki.