This discussion is archived
2 Replies Latest reply: Nov 5, 2010 1:16 PM by 612864 RSS

JMX ports and Glassfish

843798 Newbie
Currently Being Moderated
Hi,

I'm having a hell of a time getting remote JMX working for glassfish (primarily 2.1.1, though possibly 3.x in the near future).

There are no firewall issues on my test environment but the problem is we need to specify ports for it to use in production.

I have tried:
setting jvm option: -Dcom.sun.aas.jconsole.server.cbport=xxxx
creating a custom JMXConnectorServer for the web application (should this work, not entirely clear on that ...)

Anyways it's quite frustrating. I'm not hugely experienced with JMX but it seems really ridiculously difficult to get working :( I can connect to JMX through jconsole on the local machine without issue, however I simply cannot get a remote connection to work using a JMXServiceURL. Not sure if I am missing some fundamental step or what ... if anyone could provide me with some information it would be most appreciated.

I'll mention that I've been able to get remote JMX going before from a standard java application, it's just remote access in glassfish that is being a bitch.

I have tried the following URL types:
service:jmx:rmi:///jndi/rmi://<HOST>:<RMI-REGISTRY-PORT>/jmxrmi
service:jmx:rmi://<HOST>:<JVM-OPT-CBPORT>/jndi/rmi://<HOST>:<RMI-REGISTRY-PORT>/jmxrmi

... and pretty much every variation of the above w/ swapping which port is used where.

Edited by: ratdump on Sep 14, 2010 3:09 PM
  • 1. Re: JMX ports and Glassfish
    612864 Explorer
    Currently Being Moderated
    ratdump,
    Hi, the service url is different between the 2.1 and 3.0 versions of GlassFish and not fully intuitive.
    I recently added JMX support for both GlassFish servers for EclipseLink 2.1 in Eclipse.org bug# 316512

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=316512

    The JMXService url for GlassFish V3 is a really odd non-JMX spec - this is the 3.0.1 version embedded in NetBeans 6.9

    service:jmx:rmi://xps435:8686/jndi/rmi://xps435:8686/jmxrmi
    instead of an expected

    service:jmx:rmi://xps435:8686/jndi/jmxrmi

    The only difference between yours, is that the first one has two //, yours has /// - and try to remove the jndi/rmi: in the middle and add a jndi/ before the end jmxrmi - it should then work on GlassFish 2. Your 2nd entry should work on GlassFish 3

    thank you
    /michael
    http://www.eclipselink.org
  • 2. Re: JMX ports and Glassfish
    612864 Explorer
    Currently Being Moderated
    ratdump,
    Just saw your edit - stating your local works but your remote fails.
    I started up my GlassFish V 3.0.1 server on my 64-bit machine with 2 network interfaces.
    With the following Service URL I could connect via JMX both locally and remotely on my private subnet from another 32-bit server (all running the SUN 1.6 JVM)

    service:jmx:rmi://xps435:8686/jndi/rmi://xps435:8686/jmxrmi

    Actually, I forgot, GlassFish V3 lets you know the JMX Service URL to use - check your server logs for the following

    [#|2010-11-05T15:46:01.409-0400|INFO|glassfish3.0.1|javax.enterprise.system.tools.admin.org.glassfish.server|_ThreadID=1
    9;_ThreadName=Thread-18;|JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://xps435:8686/jndi/rmi://xps435:8686/jmxrmi|#]


    My results:
    enable the port via firewall popup - if required
    log from local JConsole connect
    [#|2010-11-05T15:49:26.986-0400|INFO|glassfish3.0.1|javax.enterprise.system.tools.admin.org.glassfish.server|_ThreadID=3
    0;_ThreadName=RMI TCP Connection(4)-*192.168.0.194*;|BootAMXListener: connection made for service:jmx:rmi://xps435:8686/jndi/rmi://xps435:8686/jmxrmi, booting AMX MBeans|#]
    log from remote JConsole connect
    [#|2010-11-05T15:53:01.426-0400|INFO|glassfish3.0.1|javax.enterprise.system.tools.admin.org.glassfish.server|_ThreadID=3
    1;_ThreadName=RMI TCP Connection(9)-*192.168.0.191*;|BootAMXListener: connection made for service:jmx:rmi://xps435:8686/jndi/rmi://xps435:8686/jmxrmi, booting AMX MBeans|#]

    I have not tested remote connection from a different server on 2.1 but I have tested a remote url locally.
    Is it possible to test on a 3.0.x server?

    thank you
    /michael
    http://www.eclipselink.org