1 Reply Latest reply on Mar 30, 2010 5:45 AM by jaikiran pai

    java.lang.ClassNotFoundException due to no security manager: RMI class loader disabled

    nicolas duminil Novice

      Greetings,

       

      I have the following EAR structure deployed in a JBoss AS 5.1.0.GA:

       

      myEar.ear

      |

      |--myEjbJar.jar

      |--myJar.jar

       

      Classes in myEjbJar(SLSB) are calling classes in myJar (JPA entities). The myEjbJar classes are called from a standalone client. Here is the exception (sorry for the length):

       

      -------------------------------------------------------------------------------
      Test set: fr.logica.cpv.client.TestModel
      -------------------------------------------------------------------------------
      Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.687 sec <<< FAILURE!
      testUnmarshall(fr.logica.cpv.client.TestModel)  Time elapsed: 0.641 sec  <<< ERROR!
      java.lang.RuntimeException: java.lang.ClassNotFoundException: fr.logica.cpv.model.Resource (no security manager: RMI class loader disabled)
              at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:318)
              at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:415)
              at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
              at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
              at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
              at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
              at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
              at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
              at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
              at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
      Caused by: java.lang.ClassNotFoundException: fr.logica.cpv.model.Resource (no security manager: RMI class loader disabled)
              at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
              at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
              at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
              at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:91)
              at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
              at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
              at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
              at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
              at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:309)
              at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:415)
              at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
              at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
              at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
              at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
              at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
              at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
              at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
              at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
              at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:211)
              at org.jboss.remoting.Client.invoke(Client.java:1724)
              at org.jboss.remoting.Client.invoke(Client.java:629)
              at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
              at $Proxy29.invoke(Unknown Source)
              at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
              at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
              at $Proxy28.doJpaPersist(Unknown Source)
              at fr.logica.cpv.client.TestModel.testUnmarshall(TestModel.java:41)
              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:597)
              at junit.framework.TestCase.runTest(TestCase.java:154)
              at junit.framework.TestCase.runBare(TestCase.java:127)
              at junit.framework.TestResult$1.protect(TestResult.java:106)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.framework.TestResult.run(TestResult.java:109)
              at junit.framework.TestCase.run(TestCase.java:118)
              at junit.framework.TestSuite.runTest(TestSuite.java:208)
              at junit.framework.TestSuite.run(TestSuite.java:203)
              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:597)
              at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
              at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
              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:597)
              at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
              at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
              at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
              at $Proxy29.invoke(Unknown Source)
              at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
              at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
              at $Proxy28.doJpaPersist(Unknown Source)
              at fr.logica.cpv.client.TestModel.testUnmarshall(TestModel.java:41)
              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:597)
              at junit.framework.TestCase.runTest(TestCase.java:154)
              at junit.framework.TestCase.runBare(TestCase.java:127)
              at junit.framework.TestResult$1.protect(TestResult.java:106)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.framework.TestResult.run(TestResult.java:109)
              at junit.framework.TestCase.run(TestCase.java:118)
              at junit.framework.TestSuite.runTest(TestSuite.java:208)
              at junit.framework.TestSuite.run(TestSuite.java:203)
              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:597)
              at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
              at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
              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:597)
              at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
              at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
      Caused by: java.lang.ClassNotFoundException: fr.logica.cpv.model.Resource (no security manager: RMI class loader disabled)
              at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
              at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
              at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
              at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:91)
              at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
              at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
              at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
              at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
              at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:309)
              at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:415)
              at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
              at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
              at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
              at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
              at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
              at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
              at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
              at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
              at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:211)
              at org.jboss.remoting.Client.invoke(Client.java:1724)
              at org.jboss.remoting.Client.invoke(Client.java:629)
              at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
              at $Proxy29.invoke(Unknown Source)
              at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
              at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
              at $Proxy28.doJpaPersist(Unknown Source)
              at fr.logica.cpv.client.TestModel.testUnmarshall(TestModel.java:41)
              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:597)
              at junit.framework.TestCase.runTest(TestCase.java:154)
              at junit.framework.TestCase.runBare(TestCase.java:127)
              at junit.framework.TestResult$1.protect(TestResult.java:106)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.framework.TestResult.run(TestResult.java:109)
              at junit.framework.TestCase.run(TestCase.java:118)
              at junit.framework.TestSuite.runTest(TestSuite.java:208)
              at junit.framework.TestSuite.run(TestSuite.java:203)
              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:597)
              at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
              at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
              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:597)
              at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
              at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
              at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
              at $Proxy29.invoke(Unknown Source)
              at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
              at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
              at $Proxy28.doJpaPersist(Unknown Source)
              at fr.logica.cpv.client.TestModel.testUnmarshall(TestModel.java:41)
              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:597)
              at junit.framework.TestCase.runTest(TestCase.java:154)
              at junit.framework.TestCase.runBare(TestCase.java:127)
              at junit.framework.TestResult$1.protect(TestResult.java:106)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.framework.TestResult.run(TestResult.java:109)
              at junit.framework.TestCase.run(TestCase.java:118)
              at junit.framework.TestSuite.runTest(TestSuite.java:208)
              at junit.framework.TestSuite.run(TestSuite.java:203)
              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:597)
              at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
              at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
              at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
              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:597)
              at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
              at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

       

      After having googled a while I found out that:

       

      1. As oposed to what the error states, a security manage is not required.

      2. The stand-alone client needs to be built with jbossall-client.jar, myEjb.jar and myJar.jar in its classpath.

       

      But the stand-alone client is built with all these jars in the classpath (it cannot not be built with that as it's referencing these classes and it's doing lookups).

       

      I don't know what to do. If I'm packaging every thing this way:

       

      myEar.ear

      |

      |--myEjbJar.jar

      |----myJar.jar

       

      it will probably work but I don't understand why as, at the EAR level, there is full visibility between jars and every body should be able to see every body. Is that correct ?

       

      Many thanks in adavance for any help,

       

      Nicolas

        • 1. Re: java.lang.ClassNotFoundException due to no security manager: RMI class loader disabled
          jaikiran pai Master

          2. The stand-alone client needs to be built with jbossall-client.jar,  myEjb.jar and myJar.jar in its classpath.

           

          But the stand-alone client is built  with all these jars in the classpath (it cannot not be built with that  as it's referencing these classes and it's doing lookups).

          Building the standalone client is one thing and running it is another. How do you run the client? How do you set the runtime classpath for the client? Does the runtime classpath include your jar files?

           

           

          P.S: I hope I don't get another of those 503 errrors while posting this reply!