Announcement Announcement Module
Collapse
No announcement yet.
(no security manager: RMI class loader disabled) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • (no security manager: RMI class loader disabled)

    Hi All,

    When i am trying to run a Simple App which uses Spring RMI i am getting the following Exception..

    Code:
       org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExporter' defined in class path resource [spring_service_dispatcher.xml]: Invocation of init method failed; nested exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
            java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
            java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationWrapper_Stub (no security manager: RMI class loader disabled)
    Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
            java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
            java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationWrapper_Stub (no security manager: RMI class loader disabled)
            at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
            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:466)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
            at java.lang.Thread.run(Thread.java:595)
            at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
            at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
            at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
            at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
            at org.springframework.remoting.rmi.RmiServiceExporter.prepare(RmiServiceExporter.java:255)
            at org.springframework.remoting.rmi.RmiServiceExporter.afterPropertiesSet(RmiServiceExporter.java:197)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1118)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1085)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:429)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:250)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:247)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:161)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:68)
            at com.lmco.dpa.services.framework.dispatcher.StartServiceDispatcher.main(StartServiceDispatcher.java:50)
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
            java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationWrapper_Stub (no security manager: RMI class loader disabled)
            at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
            at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
            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:466)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
            at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationWrapper_Stub (no security manager: RMI class loader disabled)
            at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
            at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
            at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
            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:1544)
            at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
    Do i need to explicitly pass the SecurityManager ??

    Thanks
    Sateesh

  • #2
    For a remote invocation the classes involved have to be present at server and client. If that is not the case RMI provides the possibility to download the classes from the server. Since that is a potential security hazard a SecurityManager has to be installed then. Though, if you just ensure that the classes you use are already present, then your code should work.

    One point to consider: When you declare a remote method taking an interface as argument type you still pass in an instance of a concrete class implementing that interface. That class has to be known at the destination also.

    Hope that helps,
    Andreas

    Comment


    • #3
      RMI Class Loading Problem

      Hi

      I'm also having the same problem as Sateesh had. I'm getting the same stack trace as he got, but the class involved (RmiTestBean) is present on both client and server (it's contained in a bundle that I've deployed in both places). I have three test methods, with the following signatures:


      public RmiTestBean rmiTestMethodReturn() {
      System.out.println("Rmi Test Method Return");
      return new RmiTestBean();
      }

      public void rmiTestMethodSimple() {
      System.out.println("Rmi Test Method Simple");
      }

      public void rmiTestMethodParameter(RmiTestBean rmiTestBean) {
      System.out.println("Rmi Test Method Parameter");
      }

      The first two work fine, but the last one fails with the same stack trace as Sateesh posted. I'm assuming that the classloader being used for RMI in rmiTestMethodParameter can't find the RmiTestBean class. Therefore it tries to download it, and gets the "no security manager: RMI class loader disabled" error while attempting the download. However it should be able to find the RmiTestBean class without needing to attempt the download. In the rmiTestMethodReturn() method it's able to create a new RmiTestBean object, but can't unmarshal the argument passed to rmiTestMethodParameter.

      Do you have any suggestions as to how I can get around this issue? Thanks for your help.

      David

      Comment

      Working...
      X