2 Replies Latest reply on Apr 24, 2010 8:46 AM by fatbatman

    Application ClassNotFound within Remoting InvocationHandler.invoke() on AS6 M2  (XPost)

    fatbatman Novice

      Hi,

       

      I'm using JBoss Remoting and in the process of upgrading the JBoss 6 M2 and I'm getting a ClassNotFound error within MyRemotingInvocationHandler.invoke(InvocationRequest invocation) when an applications class object is received by the server side invocation handler.

       

      I create my connector programmatically using the code below on a socket transport.

      The class is in the same application jar that the connector is created from, which is within deploy/myapp.ear/myapp.jar.

      The connectors are created when the application is started as an mbean from deploy/myapp.ear/myserver-service.xml

       

      This worked fine on JBoss 4 & 5 so I assume there's something different in the Class Loading from the remoting thread pool threads on JBoss 6 M2?

       

      X Posted at https://community.jboss.org/message/535658#535658 - Ron Sigal suggested I try this forum

       

      Does anyone have any suggestions?

       

      Thanks in advance

       

      James

       

       

      Server side connector set up is;

       

      Map<String, String> connectorConfig = new HashMap<String, String>();
      connectorConfig.put("callbackStore", "org.jboss.remoting.callback.BlockingCallbackStore");     //will block the thread trying to send it if memory is low.
      connectorConfig.put("return-exception","true");               //Make sure the original Exception is returned to client when using servlet
      connectorConfig.put("numAcceptThreads", "20");
      connectorConfig.put("maxPoolSize", "500");
       
       
       
      Map<String, String> locatorConfig = new HashMap<String, String>();
      locatorConfig.put("force_remote", "true");
      locatorConfig.put("leasing", "true");                         //The client will establish a lease with the server so the server can check it's still connected
      locatorConfig.put("lease_period", GlobalConstants.LEASE_PERIOD+"");                    //The period in which the server check the client is still there
       
       
      String uri = protocol + "://" + server + ":" + port + path;
       
      ServerConfiguration serverConfig = new ServerConfiguration(protocol);
      serverConfig.setInvokerLocatorParameters(locatorConfig);
       
      Connector connector1 = new Connector(connectorConfig);
      connector1.setInvokerLocator(uri);          //new InvokerLocator(protocol, server, port, path, locatorConfig);
      connector1.setServerConfiguration(serverConfig);
      connector1.setLeasePeriod(GlobalConstants.LEASE_PERIOD); 
      connector1.create();
       
      connector1.getServerInvoker().setMaxNumberOfOnewayThreads(100); 
      connector1.getServerInvoker().setSerializationType(GlobalConstants.JBOSS_REMOTING_SERIALIZATION_TYPE);
       
      MyRemotingInvocationHandler invocationHandler = new MyRemotingInvocationHandler();
      connector1.addInvocationHandler(MyConstants.REMOTING_SYSTEM, invocationHandler);
       
       
      connector1.addConnectionListener(new MyRemotingConnectionListener());
      connector1.start();
       
       
        • 1. Re: Application ClassNotFound within Remoting InvocationHandler.invoke() on AS6 M2  (XPost)
          jaikiran pai Master

          fatbatman wrote:

           

          Hi,

           

           

           

          I create my connector programmatically using the code below on a socket transport.

          The class is in the same application jar that the connector is created from, which is within deploy/myapp.ear/myapp.jar.

          The connectors are created when the application is started as an mbean from deploy/myapp.ear/myserver-service.xml

           

          This worked fine on JBoss 4 & 5 so I assume there's something different in the Class Loading from the remoting thread pool threads on JBoss 6 M2?

           

          Can you please post the entire exception stacktrace? One thing that changed in AS-6 is the .ear classloaders which are now by default isolated. I guess that might be related to your problem.

           

          By the way, if you want to try it out against the latest AS-6 nightly build, then you can download it from here http://hudson.jboss.org/hudson/job/JBoss-AS-6.0.x/lastSuccessfulBuild/artifact/JBossAS_6_0/build/target/jboss-6.0.x.zip

          • 2. Re: Application ClassNotFound within Remoting InvocationHandler.invoke() on AS6 M2  (XPost)
            fatbatman Novice

            Hi,

             

            Sorry I don't have time to check against the latest nightly build at the moment, but stacktrace is below if it helps.

             

            Regards

             

            James

             

             

            14:42:06,252 ERROR [org.jboss.remoting.transport.socket.ServerThread] WorkerThread#1[127.0.0.1:64188] exception occurred during first invocation: java.lang.ClassNotFoundException: com.joyplay.shared.dto.LogonData

                at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

                at java.lang.Class.forName0(Native Method)

                at java.lang.Class.forName(Class.java:247)

                at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:297)

                at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1129)

                at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:901)

                at org.jboss.classloader.spi.base.BaseClassLoader.doLoadClass(BaseClassLoader.java:523)

                at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:468)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

                at java.lang.Class.forName0(Native Method)

                at java.lang.Class.forName(Class.java:247)

                at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604)

                at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:172)

                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.defaultReadFields(ObjectInputStream.java:1947)

                at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)

                at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)

                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)

                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)

                at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:238)

                at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:138)

                at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:123)

                at org.jboss.remoting.transport.socket.ServerThread.versionedRead(ServerThread.java:877)

                at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:731)

                at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:721)

                at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:548)

                at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)