0 Replies Latest reply on Aug 17, 2010 5:59 PM by William Anez

    ClassLoadder Issue inside same EAR, isolated = true

    William Anez Newbie



          I'm facing some problems trying to migrate an application from JBoss 4 to JBoss 5 (currently in JBoss 4 it's working perfectly), the current issue I have is a problem with the Isolation mode, it seems to be diferent in JBoss 5 than JBoss4.


          I have two application EAR builded, the first one it's like a server (SERVER.EAR) he will coordinate the second application (lets call it ZONE.ear), so, I can be running in a single JBoss a SERVER with multiples ZONE (this is a little background why I need isolation TRUE).


           So, the problem comes when inside a service mbean that run inside my SERVER.ear (a SAR file with an implementation of ServiceMBean) y try to call a Bean into the server, so my SERVER.ear is like this:



             + Beans (JAR file)

                 + RouteBean

                 + some other beans ...

             + Interface (WAR file)

             + CoreMBean (SAR file)


           And the zone is like:



             + Beans (JAR file)


           When I deploy the two ears inside my JBoss the SERVER one is gonna to start the mbean service, and this service is gonna to start some MessageListener, two for each ZONE I have, cause each ZONE has two Queues that the Server need to listen.


           Until this point all is fine, the server start, recognizes the zones and start all the Listeners, but when I do send a message to one of those queues, and the MessageListener calls the onMessage method I got an Classloader Exception that is new for me, cause in JBoss 4 it's exactly the same implementation.


           The onMessage method is like this:


      1    Context ctx = new InitialContext();
      2    Router router = (Router) ctx.lookup("server/RouterBean/remote");
      3    ObjectMessage objMessage = (ObjectMessage) msg;
      4    router.processMessage(objMessage.getObject());



           And I got this exception on line 2:


      17:23:21,443 ERROR [STDERR] javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@198046{vfs:///home/opt/jboss-}]

      17:23:21,443 ERROR [STDERR] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1508)

      17:23:21,443 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:824)

      17:23:21,444 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)

      17:23:21,444 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:392)

      17:23:21,444 ERROR [STDERR] at com.cucho.queue.Consumer.onMessage(Consumer.java:99)

      17:23:21,444 ERROR [STDERR] at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(JMSMessageListenerWrapper.java:91)

      17:23:21,444 ERROR [STDERR] at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:823)

      17:23:21,444 ERROR [STDERR] at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:46)

      17:23:21,444 ERROR [STDERR] at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:941)

      17:23:21,445 ERROR [STDERR] at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)

      17:23:21,445 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

      17:23:21,445 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

      17:23:21,445 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)

      17:23:21,445 ERROR [STDERR] Caused by: java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@198046{vfs:///home/opt/jboss-}

      17:23:21,445 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:410)

      17:23:21,446 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:134)

      17:23:21,446 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)

      17:23:21,446 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:161)

      17:23:21,446 ERROR [STDERR] at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)

      17:23:21,446 ERROR [STDERR] at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1483)

      17:23:21,446 ERROR [STDERR] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1500)

      17:23:21,446 ERROR [STDERR] ... 12 more

      17:23:21,447 ERROR [STDERR] Caused by: java.lang.ClassNotFoundException: com.cucho.beans.Router from BaseClassLoader@198046{vfs:///home/opt/jboss-}

      17:23:21,447 ERROR [STDERR] at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:480)

      17:23:21,447 ERROR [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

      17:23:21,447 ERROR [STDERR] at java.lang.Class.forName0(Native Method)

      17:23:21,447 ERROR [STDERR] at java.lang.Class.forName(Class.java:247)

      17:23:21,448 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:406)

      17:23:21,448 ERROR [STDERR] ... 18 more

           I think the problem is the isolation implementation or mecanism, I think is diferent that the one in JBoss4, the SAR  file is not be able to see the intarfaces into the JAR in the SERVER.EAR
           I hope you can understand this :S, I try to explain it the best I could.
      Thanks in advance.