6 Replies Latest reply on Nov 11, 2009 7:35 AM by Vicky Kak

    ClassNotFoundException when moving JCA adaptor from 4.2.3 ->

    Waldo Nell Newbie

      I have written a JCA adaptor some years ago on JCA 1.5, for JBoss 3.x. I later moved it to JBoss 4.x without problems. However when I tried to deploy it under JBoss 5.1.0 GA it fails. I managed to fix most of the issues but I cannot seem to get around this one:


      17:06:26,781 ERROR [[/LogMon]] StandardWrapper.Throwable
      java.lang.NoClassDefFoundError: net/za/pwnconsulting/logmon/rar/cci/data/client/LogMessage
      at net.za.pwnconsulting.logmon.clientapi.LogMonClientAPIFactory.getCCILogMonAPI(LogMonClientAPIFactory.java:30)
      at net.za.pwnconsulting.javaconfig.core.LMS.(LMS.java:28)
      at net.za.pwnconsulting.javaconfig.core.BasicConfiguration.initConfig(BasicConfiguration.java:144)
      at net.za.pwnconsulting.javaconfig.core.AbstractConfiguration.init(AbstractConfiguration.java:189)
      at net.za.pwnconsulting.webmvc.config.WebConfiguration.(WebConfiguration.java:85)
      at net.za.pwnconsulting.webmvc.servlet.BootstrapServlet.initServlet(BootstrapServlet.java:75)
      at net.za.pwnconsulting.webmvc.servlet.AbstractBootstrapServlet.init(AbstractBootstrapServlet.java:105)
      at javax.servlet.GenericServlet.init(GenericServlet.java:212)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4122)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4421)


      Now the class in question (net/za/pwnconsulting/logmon/rar/cci/data/client/LogMessage) is deployed inside the LogMonJCA.rar file in the deploy directory. The code trying to access it resides in a LogMonConsole.ear package also in the deploy directory.

      Why would this work previously on JBoss 4.x and 3.x, but not in JBoss 5.x? Somewhere the classloader behaviour changed and is not loading classes from the RAR file.

      So either my deployment is incorrect, or I need to change the classloader behaviour in JBoss. When I bundled this class with the .ear file, I got another error where the InteractionSpec the client code sent via .execute() is not compatible with the InteractionSpec used in the RAR file. This makes sense as they are loaded by two different class loaders - hence even though they are binary compatible they are still distinct classes.

      Any help would be much appreciated.

        • 1. Re: ClassNotFoundException when moving JCA adaptor from 4.2.
          Vicky Kak Master

          The ear should have been able to access the classes present in the RAR since the CL's associated with RAR/EAR deployment should look at the common ParentDomain( which is basically the new name for UnifiedLoaderReposity in JBoss5) that holds the class cache of all the classes present in non-scoped deployments.

          Check the following MBean's displayClassInfo() operationand paste it here
          JMImplementaiton:name=Default,service=LoaderRepository

          You should enter the classname as net.za.pwnconsulting.logmon.rar.cci.data.client.LogMessage in displayClassInfo().

          • 2. Re: ClassNotFoundException when moving JCA adaptor from 4.2.
            Waldo Nell Newbie

            I get this:

            net.za.pwnconsulting.logmon.rar.cci.data.client.LogMessage Information
            Not loaded in repository cache
            


            I know my RAR is loaded:
            name='LogMonJCA.rar',service=RARDeployment
            


            and as you can see LogMessage is indeed inside the RAR archive:

            root@waldopc:/opt/jboss-5.1.0.GA/bin# jar -tf ../server/default/deploy/LogMonJCA.rar | grep LogMessage
            net/za/pwnconsulting/logmon/rar/cci/data/client/LogMessage.class
            


            Some additional info:

            java2ClassLoadingCompliance = false
            WarClassLoaderDeployer not commented out
            I do not have WEB-INF/jboss-classloading.xml files.
            I *do* make use of jboss-app.xml files - in the RAR and in the ear. In the RAR file:

            <jboss-app>
             <loader-repository>
             dot.com:loader=LogMonJCA
             <loader-repository-config>
             java2ParentDelegation=false
             </loader-repository-config>
             </loader-repository>
            </jboss-app>
            


            In the ear file:
            <jboss-app>
             <loader-repository>
             dot.com:loader=LogMonConsole
             <loader-repository-config>
             java2ParentDelegation=false
             </loader-repository-config>
             </loader-repository>
            </jboss-app>
            


            Not sure if these are the cause of the problem but I have always used it like this and it used to work just fine.

            • 3. Re: ClassNotFoundException when moving JCA adaptor from 4.2.
              Waldo Nell Newbie

              It *seems* like my code works in the standard configuration, not in the default. Does this help shed some light?

              • 4. Re: ClassNotFoundException when moving JCA adaptor from 4.2.
                Vicky Kak Master

                 

                "pwnell" wrote:
                I *do* make use of jboss-app.xml files - in the RAR and in the ear. In the RAR file:

                jboss-app.xml would not be considered in RAR, can you have jboss-classloading.xml with the same name for domain as you have for EAR.
                Check if things work then, if it does not that I can have a deep dive it this case.

                • 5. Re: ClassNotFoundException when moving JCA adaptor from 4.2.
                  Waldo Nell Newbie

                  Not really since I share that RAR across many different ears. The RAR provides a global logging and auditing framework shared by up to 7 different ears deployed in the same JBoss instance. Surely the domain names would be different then?

                  • 6. Re: ClassNotFoundException when moving JCA adaptor from 4.2.
                    Vicky Kak Master

                     

                    "pwnell" wrote:
                    Surely the domain names would be different then?

                    yes the domain names would be different for all the EAR's but they would share the same parent domain which should be "DefaultDomain", this is default behaviour.
                    If you are scoping the deployments then the classes from various deployments would not go into the common DefaultDomain, the classes can remain in the CLD specific to the scoped deployment and thus not visible to the other sibling deployments( i.e all other EAR's here).