5 Replies Latest reply on Jul 13, 2006 7:22 PM by thethirdeye

    java.lang.ClassNotFoundException --- from createMBean

      Hi,

      I am trying to create a Mock mbean using the following statment

      mbs.createMBean(MOCK_MSG_CLASS_NAME, testMsg);
      


      where MOCK_MSG_CLASS_NAME --- "com.pack.mockMsg"
      and testMsg = Object Name


      I have imported the package com.pack.mockMsg. I recieve the following exception when I exucute the testCase through Eclipse ..
      Caused by: java.lang.ClassNotFoundException: com.pack.mockMsg
       at org.jboss.mx.loading.UnifiedLoaderRepository3.loadClass(UnifiedLoaderRepository3.java:593)
       at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1192)
      

      Any help is greatly appriciated !

      Regards,
      RM


        • 1. Re: java.lang.ClassNotFoundException --- from createMBean

          A bit more information :

          the MBeanServer (mbs) used is a remote mbean server obtained through the RMIAdaptor

          mbs = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");
          


          This is the full stack trace generated

          javax.management.ReflectionException: Class not found: com.pack.mockMsg
           at org.jboss.mx.server.MBeanServerImpl.handleInstantiateExceptions(MBeanServerImpl.java:1243)
           at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1222)
           at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:233)
           at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:279)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:251)
           at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
           at org.jboss.jmx.connector.invoker.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:87)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
           at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:164)
           at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
           at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
           at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
           at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
           at sun.rmi.transport.Transport$1.run(Transport.java:153)
           at java.security.AccessController.doPrivileged(Native Method)
           at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
           at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
           at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
           at java.lang.Thread.run(Thread.java:595)
          Caused by: java.lang.ClassNotFoundException: com.pack.mockMsg
           at org.jboss.mx.loading.UnifiedLoaderRepository3.loadClass(UnifiedLoaderRepository3.java:593)
           at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1192)
           ... 40 more


          • 2. Re: java.lang.ClassNotFoundException --- from createMBean
            jaikiran

             

            javax.management.ReflectionException: Class not found: com.pack.mockMsg


            Where have you placed the jar containing this
            com.pack.mockMsg
            class in jboss. How is it packaged?



            • 3. Re: java.lang.ClassNotFoundException --- from createMBean

              Its an ear package placed in the deploy directory $JBOSS_HOME/server/default/deploy .

              Do you reckon the problem is associated with the class not being in the LoaderRepository?


              Caused by: java.lang.ClassNotFoundException: com.pack.mockMsg
               at org.jboss.mx.loading.UnifiedLoaderRepository3.loadClass(UnifiedLoaderRepository3.java:593)
               at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1192)
              
              


              Do I have to do anything else to prompt JBoss to load the class in the LoaderRepository or is placing the ear file in the deploy directory enough signal for JBoss to load the class in the repository?

              • 4. Re: java.lang.ClassNotFoundException --- from createMBean
                jaikiran

                As per the javadoc of createMBean:
                http://java.sun.com/j2ee/1.4/docs/api/javax/management/MBeanServerConnection.html#createMBean(java.lang.String,%20javax.management.ObjectName)


                The MBean server will use its Default Loader Repository to load the class of the MBean


                And the Default Loader Repository description is provided at:

                http://java.sun.com/j2ee/1.4/docs/api/javax/management/loading/ClassLoaderRepository.html

                Going by these docs, i think that the jar containing your MBean classes will have to be placed in the %JBOSS_HOME%/server/default/lib directory. Try it out and let us know if you have any issues.



                • 5. Re: java.lang.ClassNotFoundException --- from createMBean

                  Thanks matey !! The solution did work .