5 Replies Latest reply on Sep 9, 2005 1:01 AM by ben.wang

    Clustering and classloaders

    wt

      Hi,

      I've configured two JBoss 3.2.1 servers to run in the DefaultPartition. Both servers appear to startup properly and autodiscover eachother, but as soon as I start using the application, the following type of error is logged on the server that started second:

      2003-09-29 15:32:41,409 WARN [org.jboss.ha.framework.interfaces.HAPartition.DefaultPartition] RpcProtocol.Handle(): java.lang.ClassNotFoundException: No ClassLoaders found for: com.example.ExamplePK

      Other things to note are that we also have the javagroups based cache invalidation service running and have setup a classloader for our ear using jboss-app.xml.

      Thoughts?

        • 1. Re: Clustering and classloaders
          wt

          So after some more research and looking at the code for HAPartitionImpl, the ClassNotFoundException must be thrown from within the following block in the handle method:

          try
          {
          body=org.javagroups.util.Util.objectFromByteBuffer(req.getBuffer());
          }
          catch(Exception e)
          {
          log.warn("RpcProtocol.Handle(): " + e);
          return null;
          }

          I haven't tracked down the source of the message, but I'm guessing it's the primary key object of the entity whose cache needs to be invalidated. We're using custom pk objects generated by xdoclet, so from my understanding of the JBoss classloading architecture it makes sense that the javagroups util class isn't able to find a classloader for the pk because it's currently being packaged in the same jar as the entity, which is inside an ear that's using a scoped classloader.

          I guess there are three options here:

          1.) Stop using custom pk objects. In this case it shouldn't have any problems loading from the java.lang package.

          2.) Deploy the pks seperately in the server's lib/ dir. I would like our application to be self contained inside the ear, so this isn't ideal.

          3.) Stop using a scoped classloader. Not sure about this one.

          If anyone has any other ideas, that would be helpful. Thanks.

          • 2. Re: Clustering and classloaders
            wt

            I've tested out option #2 and that appears to have fixed the problem. But I'd rather go for option #1 as a long-term solution, because it keeps the application self-contained and allows us to hot deploy (wouldn't be possible for #2 because things under /lib are only deployed when the server starts.)

            Again, if there's something I'm missing here, it would be great to hear about some other options. Thanks.

            • 3. Re: Clustering and classloaders
              darranl

              I have seen similar problems with classloaders when running JBoss clustered.

              I have not been able to test it yet but I think that some fixes were put into JBoss 3.2.2 that may fix your problem.

              • 4. Re: Clustering and classloaders
                wt

                Yea, I was also hoping that something had gotten checked in for 3.2.2, but the issue still seems to be present in both RC3 and RC4.

                • 5. Re: Clustering and classloaders

                  Can you construct a sample and attach to a Jira issue so I can re-produce it? You can assign it to me.

                  thanks,

                  -Ben