0 Replies Latest reply on Feb 20, 2006 6:42 AM by mitesh Oza

    Access MBeanServer Instance from Outside the JBoss

    mitesh Oza Newbie

      hi i am new for JBoss - JMX.
      Can any one tell, how can i access the Instance of JBoss MBeanServer .

      i try with below code.

      Properties = new Properties();
      Properties.put("java.naming.factory.initial", "org.jboss.naming.HttpNamingContextFactory");
      Properties.put("java.naming.provider.url", "http://localhost:8080/invoker/JNDIFactory");
      Properties.put("java.naming.factory.url.pkgs", "org.jboss.naming.client");

      InitialContext ctx = new InitialContext(Properties); // From jndi.properties
      server = (MBeanServerConnection) ctx.lookup("jmx/invoker/HttpAdaptor");
      try {
      ObjectName name = new ObjectName("jboss.system:type=Server");
      try {
      MBeanInfo info = server.getMBeanInfo(name);
      System.out.println("JNDIclass Name:" + info.getClassName());
      } catch (InstanceNotFoundException e3) {
      // TODO Auto-generated catch block
      e3.printStackTrace();
      }


      but this is giving me the below like error stack trace.

      javax.naming.ServiceUnavailableException: Unexpected failure [Root exception is java.lang.NoClassDefFoundError: javax/transaction/Transaction]
      at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInterceptor.java:56)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
      at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:59)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
      at $Proxy0.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:529)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:508)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at JbossMonitor.JbossMonitorTest.(JbossMonitorTest.java:114)
      at JbossMonitor.JbossMonitorTest.main(JbossMonitorTest.java:238)
      Caused by: java.lang.NoClassDefFoundError: javax/transaction/Transaction
      at java.lang.Class.getDeclaredConstructors0(Native Method)
      at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
      at java.lang.Class.getConstructor0(Unknown Source)
      at java.lang.Class.getDeclaredConstructor(Unknown Source)
      at java.io.ObjectStreamClass.getExternalizableConstructor(Unknown Source)
      at java.io.ObjectStreamClass.access$1200(Unknown Source)
      at java.io.ObjectStreamClass$3.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.io.ObjectStreamClass.(Unknown Source)
      at java.io.ObjectStreamClass.lookup(Unknown Source)
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.writeObject(Unknown Source)
      at org.jboss.invocation.http.interfaces.Util.invoke(Util.java:126)
      at org.jboss.invocation.http.interfaces.HttpInvokerProxy.invoke(HttpInvokerProxy.java:103)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
      at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInterceptor.java:42)
      ... 9 more

      pls help me as soon as possible.

      lbrd