4 Replies Latest reply on Apr 15, 2003 2:27 PM by juhalindfors

    Why am I given this exception by MLET?

    arabinow

      I have the following code for MLET:

      String pulsarName = "com.peerdirect.rmapplications.master.jmx.PulsarModel" ;
      MLet mlet = new MLet();
      //Object pulsar = Class.forName (pulsarName).newInstance();
      String name = myMBeanServer.getDefaultDomain() + ":type=" + pulsarName;
      name = "type:name=mlet";
      System.out.println ("MLET: " + name);
      ObjectName objName = new ObjectName(name);
      myMBeanServer.registerMBean (mlet, objName);
      //final String MLET_URL = "file:./output/etc/test/compliance/loading/BasicConfig.mlet";
      //final String MLET_URL = "C:\\aa\\BasicConfig.mlet";
      final String MLET_URL = "file:///C:/aa/BasicConfig.mlet";
      try
      {
      DefaultLoaderRepository.loadClass (pulsarName);
      System.out.println("Too bad");
      }
      catch (Exception ignored)
      {}
      myMBeanServer.invoke (objName, "getMBeansFromURL",
      new Object[] { MLET_URL },
      new String[] { String.class.getName() }
      );

      Also, I have the following MLET tag in my BasicConfig.mlet file:
      <MLET CODE=com.peerdirect.rmapplications.master.jmx.PulsarModel
      NAME="DefaultDomain:type=com.peerdirect.rmapplications.master.jmx.PulsarModel"
      CODEBASE="file:///C:/build/GUI2/ram/run_agent"
      ARCHIVE="PeerdirectMasterServerFull.jar"
      >


      I have the following exception:
      Creating an instance of MasterAgent...
      MLET: type:name=mlet
      RuntimeMBeanException: RuntimeException in MBean operation 'getMBeansFromURL(,java.lang.String)'
      Cause: java.lang.ClassCastException: org.jboss.mx.loading.UnifiedClassLoader
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:299)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at com.peerdirect.rmapplications.agent.BaseAgent.(BaseAgent.java:93)
      at com.peerdirect.rmapplications.agent.MasterAgent.(MasterAgent.java:5)
      at com.peerdirect.rmapplications.agent.MasterAgent.main(MasterAgent.java:15)

      At the same time my file C:/build/GUI2/ram/run_agent/PeerdirectMasterServerFull.jar contains file com\peerdirect\rmapplications\master\jmx\PilsarModel.class

      What is wrong? Why am I getting the exception?

      My http adapter shows on my mlet mbean:

      LibraryDirectory java.lang.String RW UNAVAILABLE: [RuntimeErrorException: Error in MBean when getting attribute 'LibraryDirectory' Cause: java.lang.Error: NYI]
      URLs java.net.URL[] RO view the values of URLs

        • 1. Re: Why am I given this exception by MLET?
          arabinow

          I tried this thing under several different scenarion:

          when my MBean is a Standard MBean

          when my MBean is a Model MBean

          The problem occured both times.
          However, if I use Sun JMX implementation on the client (file jmxri.jar instead of jboss-jmx.jar) Standard MBean works correctly (while Model MBean still does not).

          • 2. Re: Why am I given this exception by MLET?
            arabinow

            When I use JBoss JMX implementation, I still have to use jmxtools.jar from Sun implementation, in order to have CommunicatorServer.class present in my jar file, correct?
            Or is that a cause of the problem.
            I use the following jars for client:
            jboss-jmx.jar;jmxtools.jar;jbossall-client.jar;jboss-j2ee.jar;jnp-client.jar;jnet.jar;log4j.jar

            • 3. Re: Why am I given this exception by MLET?
              athghost1

              I am also getting this exception, using similar code. A Clover coverage report at http://www.thecortex.net/clover/eg/jboss/report/org/jboss/mx/loading/UnifiedLoaderRepository3.html
              (apparently not related to JBoss directly; I found them using Google)
              suggests that the following lines (509 + 510) in the file
              UnifiedClassLoader3.java are to blame.

              if (loader instanceof UnifiedClassLoader)
              addUnifiedClassLoader((UnifiedClassLoader3)loader);

              I don't know if the cast needs to be changed,
              or the instanceof test.

              The Target exception is the interesting one in this case, and
              is a little farther down in the traceback report.

              getTargetException():
              java.lang.ClassCastException
              at org.jboss.mx.loading.UnifiedLoaderRepository3.addClassLoader(UnifiedLoaderRepository3.java:510)
              at javax.management.loading.MLet.addURL(MLet.java:231)
              at javax.management.loading.MLet.getMBeansFromURL(MLet.java:183)
              at javax.management.loading.MLet.getMBeansFromURL(MLet.java:141)

              (Hopefully the formatting isn't too horrid. :-) )

              I am also getting your LibraryDirectory() failure on my Mlet
              bean as well, although that looks to be of lower priority.

              This is as of JBoss 3.0.6.

              • 4. Re: Why am I given this exception by MLET?