participate


Remote Method Invocation (RMI) - jconsole through firewall
<<   Back to Forum  |   Give us Feedback
This topic has 4 replies on 1 page.
glindholm
Posts:6
Registered: 7/27/99
jconsole through firewall   
Mar 14, 2006 1:57 PM

 
I need some help on how to get jconsole through our firewall.

The JVM is set up with
  -Dcom.sun.management.jmxremote.port=7087

The firewall has been configured to allow access to this port (and I
can telnet to it) so that works.

But when I fire up jconsole on my machine it just hangs there.
   jconsole vivaldi.my.ubc.ca:7087

Using lsof I see a connection attempt on a completely different port:
  jconsole 32621 lindholm   12u  IPv6    7057786              TCP scandia.esd.itservices.ubc.ca:33568->vivaldi.my.ubc.ca:36302 (SYN_SENT)

The only reference to this situation that I've been able to find is from the Tomcat 5.5 documentation:
  Note:The JSR 160 JMX-Adaptor opens a second data protocol port. That is a problem when you have installed a local firewall.

So what is this second port and how do I control it?

Thanks

George
 
lmalvent
Posts:168
Registered: 2/2/98
Re: jconsole through firewall   
Mar 15, 2006 10:59 AM (reply 1 of 4)  (In reply to original post )

 
You won't be able to run jconsole through the firewall using the out-of-the-box
management agent properties but you can use the JMX APIs directly to mimic
the JVM's agent and configure all the ports used by the RMIConnectorServer.

Follow the links below for a more detailed answer:

http://forum.java.sun.com/thread.jspa?forumID=58&threadID=703567
http://archives.java.sun.com/cgi-bin/wa?A2=ind0507&L=jmx-forum&P=R894&I=-3

Regards,
Luis-Miguel ALVENTOSA
JMX - Java SE development team
Sun Microsystems, Inc.
 
glindholm
Posts:6
Registered: 7/27/99
Re: jconsole through firewall   
Mar 16, 2006 12:02 PM (reply 2 of 4)  (In reply to #1 )

 
I tried the solution given in
http://forum.java.sun.com/thread.jspa?forumID=58&threadID=703567


but I get:
java.rmi.server.ExportException: internal error: ObjID already in use



I start the JVM with
-Dcom.sun.management.jmxremote.port=7087

and my code looks like:
static{
      LocateRegistry.createRegistry(7087);
      MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
      HashMap env = new HashMap();
      JMXServiceURL url = new JMXServiceURL(
          "service:jmx:rmi://localhost:3000/jndi/rmi:localhost:7087/server");
      cs = JMXConnectorServerFactory.newJMXConnectorServer(
          url, env, mbs);
 
      cs.start();
}


started by Tomcat as a servlet loaded at startup time.

Any ideas?

George
 
glindholm
Posts:6
Registered: 7/27/99
Re: jconsole through firewall   
Mar 16, 2006 12:15 PM (reply 3 of 4)  (In reply to #2 )

 
So the problem is the
LocateRegistry.createRegistry(8087);

call. Yet if if change it to another port I get:
java.io.IOException: Cannot bind to URL [rmi:localhost:8087/server]: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: 
	java.net.ConnectException: Connection refused]

from the cs.start() call

which is why I assumed that I needed to use the same port as the JVM
 
lmalvent
Posts:168
Registered: 2/2/98
Re: jconsole through firewall   
Mar 17, 2006 2:20 AM (reply 4 of 4)  (In reply to #2 )

 
Hi George,

Two things:

1/ Don't specify the -Dcom.sun.management.jmxremote.port=7087
system property as this will start the out-of-the-box management
agent on port 7087 and we don't want this agent to run anymore
because you will be running your own.

Of course, if you want to run both agents choose two different ports
for the RMI registries.

2/ There's a bug in your JMXServiceURL, should be "rmi://localhost:7087"
instead of "rmi:localhost:7087"

Use this one:

JMXServiceURL url = new JMXServiceURL(
"service:jmx:rmi://localhost:3000/jndi/rmi://localhost:7087/server");

Regards,
Luis
 
This topic has 4 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 63
  • Guests : 118

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums