1 Reply Latest reply on Aug 23, 2002 5:57 AM by Kenneth Roper

    Loading class via RMI

    Christian Kubczak Newbie

      I tried to load a class via remote connection from another jboss server. The remote client also runs inside a jboss (both 2.4.4 with tomcat 3.2.3). Everytime I try to load the class I get a ClassNotFoundException for my class saying there's no security manager and the RMI classloader would be disabled. When I run the client application inside the jboss, from which to load the class, all works fine...
      Can anyone help me?


        • 1. Re: Loading class via RMI
          Kenneth Roper Newbie

          It's been a while since I've done this myself but here's what I reckon is happening:

          Classes are banned from being loaded over RMI unless you have a security manager installed in the JVM which is receiving the class. This is to prevent accidentally loading untrusted code -- i.e. a class -- into your JVM.

          Setting up a security manager is done by code such as:

          System.setSecurityManager(new RMISecurityManager());

          You may then need to set up a policy file to enable permissions for the local JVM to load classes -- I can't remember what the default is. Check out the Javadocs and Policytool docs for more info.

          Once this is set up, your client will be able to load classes over RMI.

          The reason your client succeeds when you run it within JBoss is that it will then share the classpath, and load the necessary classes from the classpath rather than over RMI, thus avoiding these security issues.

          Hope it helps.