Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting JConsole to remote glassfish 4.1 / 4.1.1 via JMX

GlassFish running on a host with a public ip address and jmx port 8986

On startup

JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://test.anahata.net.au:8986/jndi/rmi://test.anahata.net.au:8986/jmxrmi]]

When I try to connect via JConsole using test.anahata.net.au:8986 + user + password from another box, I get:

non-JRMP server at remote endpoint 

If I try to connect using service:jmx:rmi://test.anahata.net.au:8986/jndi/rmi://test.anahata.net.au:8986/jmxrmi

I get:

connection refused

domain.xml

> <admin-service system-jmx-connector-name="system"
> type="das-and-server">
>         <jmx-connector address="0.0.0.0" port="8986" name="system" auth-realm-name="admin-realm">
>           <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl"
> client-auth="want" cert-nickname="s1as"></ssl>
>         </jmx-connector>
>         <property name="adminConsoleContextRoot" value="/admin"></property>
>         <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"></property>
>         <property name="ipsRoot" value="${com.sun.aas.installRoot}/.."></property>
>         <das-config></das-config>
>       </admin-service>
> 
> ...
> <jvm-options>-Djava.rmi.server.hostname=test.anahata.net.au</jvm-options>

I have a smilar setup on a different vm running gf 4.1.1 and a real SSL certificate and I can connect to the it using host:port but If I try to connect using service:jmx:rmi://host.com:8886/jndi/rmi://host.com:8886/jmxrmi

I get

java.rmi.ConnectIOException: non-JRMP server at remote endpoint

Has anyone got his head around this?

like image 629
pranahata Avatar asked Feb 09 '16 10:02

pranahata


People also ask

How do I connect to JConsole remotely?

To connect JConsole to server process, in the Remote Process section, specify the URL service:jmx:rmi:///jndi/rmi://localhost:2047/fmq and credentials pertaining to the server. Default user name and password are admin and passwd respectively.

Does JConsole use JMX?

JConsole is a monitoring tool for Java Management Extensions. It uses a wide array of JMX instrumentation and gives you data on resource consumption as well as the performance of Java applications. You can start JConsole by running the JConsole executable, which you can find on the JDK_HOME/bin directory.

How do you expose a JMX port?

To open the JMX port on the remote JVM, you must enter the port number to use for the JMX RMI connection. Be sure to specify an unused port number. From a command line, go to the bin directory in the <JRE_HOME> directory that contains the Java Runtime Environment (JRE) implementation, for example jre/bin.

What port does JConsole use?

The default port is 1099. A username and password that you have configured in the JVM to be able to connect to the JMX service.


1 Answers

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.port=8686
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=myremoteip

Since glassfish 4 this is the only way.

Though I did managed to connect to glassfish's own jmx only before running asadmin enable-secure-admin.

turn on logging to FINE see if you got "LoginException during JMX auth"

javax.enterprise.system.tools.admin.security

Anyway my conclusion was lot of headache, just use the jvm jmx above.

like image 87
Hai Tuong Avatar answered Oct 07 '22 00:10

Hai Tuong