3 Replies Latest reply on Sep 22, 2005 11:57 PM by alan4077alda

    java.lang.ClassNotFoundException: No ClassLoaders found erro

    alan4077alda

      I am a new remoting user and I am having trouble getting started with it. I am using the version of remoting that ships with JBoss_4_0_1_SP1 date=200502160314. Because there is a lot of text related to the service xml and exceptions here, I have numbered my comments so you can follow them.

      1. I am using the following remoting-service.xml under server/all/deploy:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE server>
      
      <!-- ======================================================== -->
      <!-- Example JBoss Remoting Service Configuration file -->
      <!-- ======================================================== -->
      <server>
      
       <!-- NOTE: set this up to the path where your libraries are -->
       <classpath codebase="lib"
       archives="*"/>
      
       <mbean code="org.jboss.remoting.network.NetworkRegistry"
       name="jboss.remoting:service=NetworkRegistry"/>
      
       <mbean code="org.jboss.remoting.transport.Connector"
       xmbean-dd="org/jboss/remoting/transport/Connector.xml"
       name="jboss.remoting:service=Connector,transport=Socket"
       display-name="Socket transport Connector">
      
       <attribute name="InvokerLocator">socket://${jboss.bind.address}:8084</attribute>
      
       <!-- Uncomment when JMXSubsystemInvocationHandler is finished -->
       <attribute name="Configuration">
       <handlers>
       <handler subsystem="JMX">org.jboss.mx.remoting.JMXSubsystemInvocationHandler</handler>
       </handlers>
       </attribute>
      
      
       </mbean>
      
       <mbean code="org.jboss.remoting.transport.Connector"
       xmbean-dd="org/jboss/remoting/transport/Connector.xml"
       name="jboss.remoting:service=Connector,transport=Async"
       display-name="Async transport Connector">
       <attribute name="InvokerLocator">async://${jboss.bind.address}:8085/?compression=-1&amp;tcp.nodelay=true</attribute>
       </mbean>
      
       <!-- you must have axis.jar, saaj.jar and jaxrpc.jar in your lib path for soap -->
       <!--mbean code="org.jboss.remoting.transport.Connector"
       xmbean-dd="org/jboss/remoting/transport/Connector.xml"
       name="jboss.remoting:service=Connector,transport=soap">
      
       <attribute name="InvokerLocator">soap://localhost</attribute>
       <attribute name="Configuration">
       <handlers>
       <handler subsystem="JMX">org.jboss.mx.remoting.JMXSubsystemInvocationHandler</handler>
       </handlers>
       </attribute>
       </mbean-->
      
       <mbean code="org.jboss.remoting.detection.multicast.MulticastDetector"
       name="jboss.remoting:service=Detector,transport=multicast">
       <!-- you can specifically bind the detector to a specific IP address here
       <attribute name="BindAddress">${jboss.bind.address}</attribute>
       -->
       <attribute name="Port">5555</attribute>
       </mbean>
      
       <mbean code="org.jboss.remoting.ClientInvokerAdapter"
       xmbean-dd="org/jboss/remoting/ClientInvokerAdapter.xml"
       name="jboss.remoting:service=InterceptorAdapter">
       </mbean>
      
      </server>
      
      


      2. The only thing I have done that is different from the default file is that I have uncommented the following lines:
       <attribute name="Configuration">
       <handlers>
       <handler subsystem="JMX">org.jboss.mx.remoting.JMXSubsystemInvocationHandler</handler>
       </handlers>
       </attribute>
      


      3. I always getting the following exception:
      WARN [ServiceController] Problem starting service jboss.remoting:service=Connector,transport=Socket
      java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.mx.remoting.JMXSubsystemInvocationHandler
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:198)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:464)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:374)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at org.jboss.remoting.transport.Connector.start(Connector.java:182)
       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:324)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:908)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:416)
       at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
       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:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:463)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
      
      


      4. This happens even when I try to create a simple invoker locator and handler as described in the famous ONJava article on Remoting as well as the Remoting User Guide.

      Please help!

      Thanks,
      Alan

        • 1. Re: java.lang.ClassNotFoundException: No ClassLoaders found

          First, I would suggest getting the latest version of the JBoss Remoting distribution if only interested in learning more about just JBoss Remoting. The distribution contains several samples along with a user guide that walks through all the examples, step by step.

          That aside, the reason that you are getting this error is that org.jboss.mx.remoting.JMXSubsystemInvocationHandler does not exist (was only put there as a place holder and is why is commented out).

          • 2. Re: java.lang.ClassNotFoundException: No ClassLoaders found
            alan4077alda

            Thanks for your reply. I downloaded and installed JBoss 4.0.3 RC2, which should have a recent version of Remoting. I am getting the same error when I try one of the samples in the distribution (SimpleServer).

            Now I can be considered a newbie to JBoss in general and Remoting in particular. So I am going to highlight exactly how I have set this up - I know I am doing something wrong (possibly something very simple), but I don't know what it is. One of the problems with the Remoting documentation is that it neither goes into details of where to place what, nor does it reference any relevant jboss doco. that is a pre-requisite.

            1.

            bash-2.03# pwd
            /jboss-4.0.3RC2/server/default/deploy
            


            2.
            bash-2.03# ls -al
            total 426
            ..
            ..
            drwxr-xr-x 4 root other 512 Mar 24 23:03 RemotingTest.sar
            ..
            ..
            


            3.
            bash-2.03# cd RemotingTest.sar/
            bash-2.03# ls -al
            total 8
            drwxr-xr-x 4 root other 512 Mar 24 23:03 .
            drwxr-xr-x 13 root other 1024 Mar 24 23:03 ..
            drwxr-xr-x 2 root other 512 Mar 24 23:03 META-INF
            drwxr-xr-x 3 root other 512 Mar 24 23:03 org
            


            4.
            bash-2.03# find org/ -type f
            org/jboss/remoting/samples/callback/CallbackClient$CallbackHandler.class
            org/jboss/remoting/samples/callback/CallbackClient.class
            org/jboss/remoting/samples/callback/CallbackServer$SampleInvocationHandler.class
            org/jboss/remoting/samples/callback/CallbackServer.class
            org/jboss/remoting/samples/detection/SimpleDetectorClient.class
            org/jboss/remoting/samples/detection/SimpleDetectorServer$SampleInvocationHandler.class
            org/jboss/remoting/samples/detection/SimpleDetectorServer.class
            org/jboss/remoting/samples/oneway/OnewayClient.class
            org/jboss/remoting/samples/oneway/OnewayServer$SampleInvocationHandler.class
            org/jboss/remoting/samples/oneway/OnewayServer.class
            org/jboss/remoting/samples/simple/SimpleClient.class
            org/jboss/remoting/samples/simple/SimpleServer$SampleInvocationHandler.class
            org/jboss/remoting/samples/simple/SimpleServer.class
            org/jboss/remoting/samples/stream/sample.txt
            org/jboss/remoting/samples/stream/StreamingClient.class
            org/jboss/remoting/samples/stream/StreamingServer$TestStreamInvocationHandler.class
            org/jboss/remoting/samples/stream/StreamingServer.class
            


            5.
            bash-2.03# cat META-INF/jboss-service.xml
            <?xml version="1.0" encoding="UTF-8"?>
            
            <server>
            <mbean code="org.jboss.remoting.transport.Connector"
             xmbean-dd="org/jboss/remoting/transport/Connector.xml"
             name="jboss.remoting:service=Connector,transport=Socket">
             <attribute name="InvokerLocator">
             socket://localhost:5400
             </attribute>
             <attribute name="Configuration">
             <handlers>
             <handler subsystem="SUBSYS">
             org.jboss.remoting.samples.simple.SimpleServer
             </handler>
             </handlers>
             </attribute>
            </mbean>
            </server>
            


            6. The exception I am getting while starting up jboss:
            23:05:56,268 WARN [ServiceController] Problem starting service jboss.remoting:service=Connector,transport=Socket
            java.lang.ClassNotFoundException: No ClassLoaders found for:
             org.jboss.remoting.samples.simple.SimpleServer
            
             at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:198)
             at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:475)
             at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:377)
             at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
             at org.jboss.remoting.transport.Connector.configureHandlers(Connector.java:506)
             at org.jboss.remoting.transport.Connector.start(Connector.java:219)
             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:324)
             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.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.system.ServiceController$ServiceProxy.invoke(ServiceController.java:991)
             at $Proxy0.start(Unknown Source)
             at org.jboss.system.ServiceController.start(ServiceController.java:453)
             at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:324)
             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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
             at $Proxy4.start(Unknown Source)
             at org.jboss.deployment.SARDeployer.start(SARDeployer.java:276)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:973)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
             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:324)
             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.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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
             at $Proxy9.deploy(Unknown Source)
             at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)
             at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:265)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:287)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:236)
             at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:324)
             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.system.ServiceController$ServiceProxy.invoke(ServiceController.java:974)
             at $Proxy0.start(Unknown Source)
             at org.jboss.system.ServiceController.start(ServiceController.java:453)
             at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:324)
             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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
             at $Proxy4.start(Unknown Source)
             at org.jboss.deployment.SARDeployer.start(SARDeployer.java:276)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:973)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:721)
             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:324)
             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.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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
             at $Proxy5.deploy(Unknown Source)
             at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:451)
             at org.jboss.system.server.ServerImpl.start(ServerImpl.java:328)
             at org.jboss.Main.boot(Main.java:187)
             at org.jboss.Main$1.run(Main.java:438)
             at java.lang.Thread.run(Thread.java:534)
            


            • 3. Re: java.lang.ClassNotFoundException: No ClassLoaders found
              alan4077alda

              I found the issue. For one, I was doing something that was somewhat stupid. SimpleServer does not implement ServerInvocationHandler. The handler must of course, implement that interface. Secondly, I found that having a newline after the classname in the XML matters for the service file - with the newline, I was getting the aforementioned ClassNotFoundException, without the newline, I started getting the ClassCastException. Upon getting the ClassCastException, I dove into the jboss code to discover the cause for the error I was making.