4 Replies Latest reply: Dec 22, 2011 5:58 AM by Alexis Hassler RSS

How to access JMX via a firewall on AS 7

Alexis Hassler Novice

Hi,

 

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.

-Djava.rmi.server.hostname=ec2-100-20-180-80.compute-1.amazonaws.com

-Djava.rmi.server.useLocalHostname=false

 

 

How could I do to access to my server with JMX ?