EAP6 deployed application throws javax.naming.NameNotFoundException: rmi://localhost:1099/jmxrmi

Solution Unverified - Updated -

Issue

  • How Do We Make A JMX connection From A Client Deployed In EAP 6 To A NON EAP JVM?

  • While running an Application deployed on EAP6, Which tries to connect to a remote Standalone java program via MBeanServerConnection then it throws the following exception:

java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: rmi://localhost:1099/jmxrmi -- service jboss.naming.context.java.rmi:."localhost:1099".jmxrmi
    javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:342)
    javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:267)
    aaa.HeapAndNonHeapMonitoring.connectWRONG(HeapAndNonHeapMonitoring.java:29)
    org.apache.jsp.wrongOption_jsp._jspService(wrongOption_jsp.java:65)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
root cause
javax.naming.NameNotFoundException: rmi://localhost:1099/jmxrmi -- service jboss.naming.context.java.rmi:."localhost:1099".jmxrmi
    org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
    org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
    org.jboss.as.naming.InitialContext.lookup(InitialContext.java:119)
    org.jboss.as.naming.NamingContext.lookup(NamingContext.java:215)
    javax.naming.InitialContext.lookup(InitialContext.java:409)
    javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1902)
    javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1871)
    javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:276)
    javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:267)
    aaa.HeapAndNonHeapMonitoring.connectWRONG(HeapAndNonHeapMonitoring.java:29)
    org.apache.jsp.wrongOption_jsp._jspService(wrongOption_jsp.java:65)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
  • Following is the JMX Connectivity code which we are using:
                  Integer portInteger = Integer.valueOf(port);
                  Hashtable feature=new Hashtable();
                  JMXServiceURL address = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"+hostname+":"+port+"/jmxrmi");
                  MBeanServerConnection connector = JMXConnectorFactory.connect(address,feature);
                  JMXConnector connection = connector.getMBeanServerConnection();

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content