title: Connecting JConsole to remote glassfish 4.1 / 4.1.1 via JMX
body: <p>GlassFish running on a host with a public ip address and jmx port 8986</p>
  
  <p>On startup </p>
  
  <pre><code>JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://test.anahata.net.au:8986/jndi/rmi://test.anahata.net.au:8986/jmxrmi]]
  </code></pre>
  
  <p>When I try to connect via JConsole using test.anahata.net.au:8986 + user + password from another box, I get:</p>
  
  <pre><code>non-JRMP server at remote endpoint 
  </code></pre>
  
  <p>If I try to connect using    service:jmx:rmi://test.anahata.net.au:8986/jndi/rmi://test.anahata.net.au:8986/jmxrmi</p>
  
  <p>I get:</p>
  
  <pre><code>connection refused
  </code></pre>
  
  <p>domain.xml </p>
  
  <pre><code>&gt; &lt;admin-service system-jmx-connector-name="system"
  &gt; type="das-and-server"&gt;
  &gt;         &lt;jmx-connector address="0.0.0.0" port="8986" name="system" auth-realm-name="admin-realm"&gt;
  &gt;           &lt;ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl"
  &gt; client-auth="want" cert-nickname="s1as"&gt;&lt;/ssl&gt;
  &gt;         &lt;/jmx-connector&gt;
  &gt;         &lt;property name="adminConsoleContextRoot" value="/admin"&gt;&lt;/property&gt;
  &gt;         &lt;property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"&gt;&lt;/property&gt;
  &gt;         &lt;property name="ipsRoot" value="${com.sun.aas.installRoot}/.."&gt;&lt;/property&gt;
  &gt;         &lt;das-config&gt;&lt;/das-config&gt;
  &gt;       &lt;/admin-service&gt;
  &gt; 
  &gt; ...
  &gt; &lt;jvm-options&gt;-Djava.rmi.server.hostname=test.anahata.net.au&lt;/jvm-options&gt;
  </code></pre>
  
  <p>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</p>
  
  <p>I get </p>
  
  <pre><code>java.rmi.ConnectIOException: non-JRMP server at remote endpoint
  </code></pre>
  
  <p>Has anyone got his head around this?</p>