1 Reply Latest reply on May 23, 2007 11:03 AM by Maxim Gordienko

    loading classes by unregistered classloader

    Maxim Gordienko Newbie

      I really don't know where to post this message, so post it here.
      I have an ear containing sar archive. Ear uses own classloader repository defined in META-INF/jboss-app.xml. Sar contains MBean exporting service via RMI, all dependant classes are in the server lib directory.
      If I put ear into deploy directory and start Jboss (v 4.0.4, the same applies to 4.0.5) everything works fine.
      But if I redeploy ear, Jboss gives me NullPointerException (actually ClassNotFoundException) loading one of my classes.

      Detailed stack trace

      java.lang.NullPointerException
       at org.jboss.mx.loading.RepositoryClassLoader.findClass(RepositoryClassLoader.java:620)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:464)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:242)
       at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:154)
       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: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)
       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)
       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:256)
      

      (Yes, it's spring RMI exporter)

      After class loading log investigation I've found

      [2961838,RepositoryClassLoader,ScannerThread] Unregistering cl=org.jboss.mx.loading.UnifiedClassLoader3@1171d93{ url=file:/opt/jboss-4.0.4.GA/server/default/tmp/deploy/tmp34664arch.ear ,addedOrder=33}
      [2961838,UnifiedLoaderRepository3,ScannerThread] UnifiedLoaderRepository removed(true) org.jboss.mx.loading.UnifiedClassLoader3@1171d93{ url=file:/opt/jboss-4.0.4.GA/server/default/tmp/deploy/tmp34664arch.ear ,addedOrder=33}
      
      ..............
      
      [3014174,RepositoryClassLoader,RMI TCP Connection(1)-10.0.5.7] loadClass org.jboss.mx.loading.UnifiedClassLoader3@1171d93{ url=null ,addedOrder=33} name=org.springframework.remoting.rmi.RmiInvocationWrapper_Stub, loadClassDepth=0
      [3014174,RepositoryClassLoader,RMI TCP Connection(1)-10.0.5.7] loadClassImpl, name=org.springframework.remoting.rmi.RmiInvocationWrapper_Stub, resolve=false [3014174,RepositoryClassLoader,RMI TCP Connection(1)-10.0.5.7] findClass, name=org.springframework.remoting.rmi.RmiInvocationWrapper_Stub
      [3014175,RepositoryClassLoader,RMI TCP Connection(1)-10.0.5.7] loadClass org.jboss.mx.loading.UnifiedClassLoader3@1171d93{ url=null ,addedOrder=33} name=org.springframework.remoting.rmi.RmiInvocationWrapper_Stub not found
      


      In first section - class loader destroyed, in second used again to load classes (between these two steps there is not classloading recreation)

      My guess - usage of unregistered classloader. Is it true? And how can I fix it?

      Thank you!