3 Replies Latest reply on Dec 7, 2008 7:09 AM by Jacek Zawłocki

    how to enable RMI class loading

    Armin Vogt Newbie

      Let me try to make that question short:
      I get

      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: palmyra.baustein.geschaeftsverwaltung.antrag.ProtokollVBeanEjb (no security manager: RMI class loader disabled)
      


      WAIT, I resolved that by enabling security policy that allows for RMI class loading.

      Now I still get java.lang.ClassNotFoundException, but without the RMI hint.

      I'd like to actually use RMI class loading. From what I read, there is nothing more to to (in JBoss 4.2.2) but to go to deploy/ejb3.deployer/META-INF/jboss-service.xml and have:
      <mbean code="org.jboss.remoting.transport.Connector"
       name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
       <depends>jboss.aop:service=AspectDeployer</depends>
       <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873/</attribute>
      


      changed to
      <mbean code="org.jboss.remoting.transport.Connector"
       name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
       <depends>jboss.aop:service=AspectDeployer</depends>
       <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873/?loaderport=4873</attribute>
      


      I'd really like to achieve having ie. a standalone client application without my EJBs interfaces in the class path to successfully make a lookup on my ejb.

      1) Is it supposed to work at all?
      2) How is it configured?


        • 1. Re: how to enable RMI class loading
          Armin Vogt Newbie

          Ok, i enabled trace logging (described here: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=126382 ).

          I'm using a standalone client application. The log says:

          12:03:06,794 DEBUG [SocketWrapper] ServerSocketWrapper[Socket[addr=/127.0.0.1,port=1222,localport=4873].12a5dd1] closing
          12:03:11,422 TRACE [JavaSerializationManager] Creating ObjectOutputStream
          12:03:11,438 TRACE [JavaSerializationManager] Creating ObjectInputStreamWithClassLoader
          12:03:11,453 DEBUG [ClientSocketWrapper] reset timeout: 320000
          12:03:11,485 TRACE [JavaSerializationManager] Creating ObjectOutputStream
          12:03:11,485 TRACE [JavaSerializationManager] Creating ObjectInputStreamWithClassLoader
          12:03:11,500 DEBUG [ClientSocketWrapper] reset timeout: 320000
          12:03:11,500 DEBUG [MarshallerLoaderHandler] MarshallerLoaderHandler received invocation with param of load_class and data type of
           null
          12:03:14,221 TRACE [ClassUtil] trying to load class: palmyra.baustein.bestandsdaten.partner.PartnerSelektierenVBean from path: pal
          myra/baustein/bestandsdaten/partner/PartnerSelektierenVBean.class
          12:03:14,221 TRACE [ClassByteClassLoader] getResourceAsStream =>palmyra.baustein.bestandsdaten.partner.PartnerSelektierenVBean = n
          ull
          12:03:14,346 DEBUG [MarshallerLoaderHandler] MarshallerLoaderHandler received invocation with param of load_class and data type of
           null
          12:03:14,940 TRACE [ClassUtil] trying to load class: palmyra.baustein.bestandsdaten.partner.PartnerSelektierenVBean from path: pal
          myra/baustein/bestandsdaten/partner/PartnerSelektierenVBean.class
          12:03:14,940 TRACE [ClassByteClassLoader] getResourceAsStream =>palmyra.baustein.bestandsdaten.partner.PartnerSelektierenVBean = n
          ull
          12:03:14,971 DEBUG [ServerThread] WorkerThread#0[127.0.0.1:1227] closing socketWrapper: ServerSocketWrapper[Socket[addr=/127.0.0.1
          ,port=1227,localport=3873].1be032b]
          12:03:14,971 DEBUG [ServerSocketWrapper] wrote CLOSING
          12:03:14,971 DEBUG [ServerThread] WorkerThread#1[127.0.0.1:1228] closing socketWrapper: ServerSocketWrapper[Socket[addr=/127.0.0.1
          ,port=1228,localport=4873].1c1fcf1]
          12:03:14,987 DEBUG [SocketWrapper] ServerSocketWrapper[Socket[addr=/127.0.0.1,port=1227,localport=3873].1be032b] closing
          12:03:14,987 DEBUG [ServerSocketWrapper] wrote CLOSING
          12:03:15,018 DEBUG [SocketWrapper] ServerSocketWrapper[Socket[addr=/127.0.0.1,port=1228,localport=4873].1c1fcf1] closing
          12:03:19,958 TRACE [MicroRemoteClientInvoker] org.jboss.remoting.transport.http.HTTPClientInvoker@13e6be6 disconnecting ...
          12:03:19,958 TRACE [MicroRemoteClientInvoker] org.jboss.remoting.transport.http.HTTPClientInvoker@13e6be6 is not connected!
          


          What it says is: the ClassByteClassLoader (in the jboss) cannot find the class. In the debugger I found in line
          org.jboss.remoting.loading.ClassUtil.getClassBytes:190

          the ClassByteClassLoader is virtually empty with only a reference to its parent class loader being some
          org.jboss.mx.loading.UnifiedClassLoader3@182c132{ url=null ,addedOrder=2}


          I have deployed the ejb3 in question in an ear file with this jboss-app.xml:
          <!DOCTYPE jboss-app
           PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"
           "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">
          <jboss-app>
           <loader-repository>
           palmyra-bsp-bestandsdaten-1.0:loader=bsp-bestandsdaten-1.0.EAR
           <loader-repository-config>
           java2ParentDelegation=true
           </loader-repository-config>
           </loader-repository>
          </jboss-app>
          

          and I want to stay with separate loader repositories per ear file.

          Is that the problem?

          What I didn't understand is: which classes are server for remote class loading from the jboss? Do I have to make my ear file known to the server invoker?


          • 2. Re: how to enable RMI class loading
            Armin Vogt Newbie

            Ok, that is the problem:

            once i emptied the jboss-app.xml, the example works.

            Please, somebody tell me, that it is somehow possible to have isolated loader repositories per ear and still allow for remote class loading...

            • 3. Re: how to enable RMI class loading
              Jacek Zawłocki Newbie

              You should copy your business interfaces to the global class loader on top of your ear class loader. Let's say that you have

              @Remote
              MyInterfate{}

              @Stateless
              MyBean implements MyInterface{
              }

              So you should place MyBean in your ear, but MyInterface should be located outside ear, directly in your deploy directory.