9 Replies Latest reply on Apr 15, 2003 2:16 PM by Juha Lindfors

    java.lang.ClassCastException when using MLets

    David Newman Newbie

      I am having problems using MLets. For example when I invoke the following code:

      MLet mlet = new MLet(jarURL);
      server.registerMBean(mlet, loader);
      server.createMBean(clazz, obj, loader);

      I get the below error:

      19:25:17,596 ERROR [MBeanServerImpl] Unhandled exception instantiating class: com.wellsfargo.ice.management.ExportManager
      java.lang.ClassCastException: org.jboss.mx.loading.UnifiedLoaderRepository2
      at javax.management.loading.MLet.loadClass(MLet.java:276)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
      at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:790)
      at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:266)
      at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:243)
      at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:286)
      at com.wellsfargo.ice.management.Deployer.redeploy(Deployer.java:96)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:232)
      at org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:200)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:171)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:77)
      at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:59)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:284)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:577)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1674)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:544)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1624)
      at org.mortbay.http.HttpServer.service(HttpServer.java:875)
      at org.jboss.jetty.Jetty.service(Jetty.java:541)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:785)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:935)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:802)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:200)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:294)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)
      at java.lang.Thread.run(Thread.java:479)

      I have to use the following code to successfully hot deploy:

      URLClassLoader urlcl = URLClassLoader.newInstance(jarURL, Thread.currentThread().getContextClassLoader());
      Object mgdObj = urlcl.loadClass(clazz).newInstance();
      server.registerMBean(mgdObj, obj);

      Am I using MLets incorrectly, or is there a bug somewhere in the MLet implementation in JBoss 3.0.3?

      Thanks,

      David