7 Replies Latest reply on Oct 15, 2007 2:24 AM by Dominik Kunz

    ClassLoader isolation

    Dominik Kunz Newbie

      Hi there,

      how can I get ClassLoader isolation done in a .esb archive?

      The environment:
      JBoss AS 4.0.5 <-- communicate --> jbossesb-server-4.2GA
       ^ ^
       | |
       EJB .esb archive

      The problem:
      In a Action I bind to a home interface of an EJB running on JBoss AS 4.0.5, this EJB, however messes around with Hibernate in a different version as included in jbossesb-server-4.2GA, so that I get a class version exception (invalid serial version uuid).

      The question:
      How can I tell the esb-app (deployed as .esb archive) to use a different hibernate jar as the one included in ../server/default/lib on jbossesb-serer-4.2GA.
      I included the right hibernate jar in the root of the esb archive, but this did not give me the expected result.

      Thanks for your efforts.

        • 1. Re: ClassLoader isolation
          Kevin Conner Master

          By default the esb runs in a global class loading scope and will defer to the version of hibernate included in the AS.

          To run with a scoped class loader you need to add something like the following into your deployment.xml file in the META-INF directory.


          Having said all this I should point out that exposing hibernate classes to a client suggests that something is wrong on the 4.0.5 server. This is an internal implementation detail and should really have been hidden from the client.

          • 2. Re: ClassLoader isolation
            Dominik Kunz Newbie

            Thanks for your very fast reply! Your suggestion works perfect.

            Just to mention, I now get following WARN during the deployment:

            WARN [DeploymentInfo] Only the root deployment can set the loader
            repository, ignoring config=LoaderRepositoryConfig(repositoryName: de.xyz:loader=MyTest.esb, repositoryClassName: org.jboss.mx.loading.HeirarchicalLoaderRepository3, configParserClassName:
             org.jboss.mx.loading.HeirarchicalLoaderRepository3ConfigParser, repositoryConfig: java2ParentDelegaton=false)

            • 3. Re: ClassLoader isolation
              Kevin Conner Master

              You can only specify the classloader on the outer artifact. If you include your esb artifact in another artifact then it will use whichever classloader is configured for the outer one.

              The error message would therefore imply that MyTest.esb is included within something else. Is this the case?

              • 4. Re: ClassLoader isolation
                Dominik Kunz Newbie

                No, the .esb archive is the outer artifact.
                Your suggestion also worked for me. It seems to me that I get the WARN output, but it doesn't have any effects. JBossESB is using my scoped classloader.

                • 5. Re: ClassLoader isolation
                  Kevin Conner Master

                  It can't be using it. If you get the warning then the deployer has refused to create the classloader as the deployment info is already associated with a parent classloader.

                  If you go to the jmx-console do you see the bean de.xyz:loader=MyTest.esb? Can you send me your esb artifact?

                  • 6. Re: ClassLoader isolation
                    Dominik Kunz Newbie

                    I am going to double check this on monday. Going on a short trip this weekend... I will post my results on monday.

                    • 7. Re: ClassLoader isolation
                      Dominik Kunz Newbie

                      Sorry. This was my fault, I saw this only once and I can't reproduce it. Now the deployment doesn't bring up any WARNs.

                      So thanks for your answers!