title: Invoke Mbean via client program
body: <p>I created an mbean. Below is my configuration. I could see my bean configuration after the server startup on JMX console. I tried to stop/start the mbean from the jmx console and it is working. </p>
  
  <p>But when I am writing the code to invoke the mbean via program running in the same JVM, I could not see my bean</p>
  
  <p>mbean details : xyz.abc.test:service=myTestService,name=myTestServiceName</p>
  
  <pre><code>MBeanServer server = ManagementFactory.getPlatformMBeanServer();
  try {
      Set&lt;ObjectName&gt; names = new TreeSet&lt;ObjectName&gt;(server.queryNames(null, null));
      for (ObjectName name : names) {
          System.out.println("\tObjectName = " + name);
      }
  </code></pre>
  
  <p>The above code is not printing my bean to invoke. Even client program is not working.</p>
  
  <pre><code>url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8080/jmxrmi");
  JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
  MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
  </code></pre>