pranahata
pranahata

Reputation: 540

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?

Upvotes: 6

Views: 2311

Answers (2)

tak3shi
tak3shi

Reputation: 2405

When you get this error:

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

you are missing the keystore.jks file from glassfish/payara domain.

Upvotes: 0

Hai Tuong
Hai Tuong

Reputation: 76

-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.

Upvotes: 5

Related Questions