0 Replies Latest reply on Apr 15, 2002 5:21 PM by Avinash

    Cannot bootstrap classes from local file m-let syntax)

    Avinash Newbie

      I have included following code to read m-let file and bootstrap classes from it. It seems that program hangs, while attempting to execute "getMBeansFromURL("file:/C:/wasd/jboss.CONF")". Following provides listing of m-let file as well actual java code. Can someone provide assistance to resolve this issue? Program compiles with any exceptions.

      m-let file:
      ___________

      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss JMX Boot-strap Configuration -->
      <!-- -->
      <!-- ===================================================================== -->

      <!-- The log4j based logging service based on the conf log4j.properties file -->
      <MLET CODE = "org.jboss.logging.Log4jService"
      ARCHIVE="jboss.jar,log4j.jar"
      CODEBASE="file://C:/wasd/>



      Java Code:
      ____________


      package testjmx;

      import javax.management.*;
      import javax.management.JMException;
      import javax.management.MalformedObjectNameException;

      import javax.management.loading.*;
      import java.io.*;
      import java.net.*;
      import java.util.*;

      public class NetworkApp {
      public static void main(String[] args) {

      MBeanServer server =
      MBeanServerFactory.createMBeanServer();
      ObjectName name = null;
      MLet mlet = null;

      try {
      mlet= new MLet();
      name = new ObjectName(server.getDefaultDomain(),"service","MLet");
      server.registerMBean(mlet,name);
      Thread.currentThread().setContextClassLoader(mlet);
      Set beans = (Set)mlet.getMBeansFromURL("file:/C:/wasd/jboss.CONF");
      Iterator enum = beans.iterator();
      while (enum.hasNext()) {
      Object obj = enum.next();
      System.out.println("I am here");
      if (obj instanceof ObjectInstance) {
      System.out.println(((ObjectInstance)obj).getObjectName());

      } else {
      ((Throwable)obj).printStackTrace();

      }

      }
      com.sun.jdmk.comm.HtmlAdaptorServer adaptor =
      new com.sun.jdmk.comm.HtmlAdaptorServer();
      server.registerMBean(adaptor,
      new ObjectName("adaptor:protocol=HTTP"));
      adaptor.start();
      } catch (JMException e) {
      e.printStackTrace();
      }
      }

      }