2 Replies Latest reply on Sep 30, 2004 9:53 AM by hans.neber

    Classloader Issue?

    hans.neber

      I have an ear and a war, with some classes contained in both of them. The servlet contexts in both applications are named differently. It now happens that, when the war is deployed and I try to hot-redeploy the ear, subsequent access to a jsp results in a ClassCastException at the line representing the useBean-Tag.

      VG = (com.mycompany.VGActionForm) pageContext.getAttribute("VG", PageContext.SESSION_SCOPE);


      When I move the war away and hot-redeploy the ear (e.g. with unix' 'touch' command), this Exception does not occur, the jsp gets processed correctly.

      The problem also does not occur when I restart JBoss having both apps in the deploy-dir.

      As I have the understanding that the ear and the war get different classloaders, I have no idea how one should be able to affect the other. Further, there is no warning or error during the hot re-deployment that would point out any conflicts.

      Any hints about where to look or further analyse the problem would be appreciated.

      Regards, Hans

        • 1. Re: Classloader Issue?
          frito

          You have to configure a different loader-repository for every deployment unit and isolate them agains each other (if every deployment unit has all the resoureces needed with it!).
          Every invocation from the war to your ejbs will go through marshalling and you won't have any problems with classloaders.

          If you want to share resources, you have to redeploy all involved deployment units.

          • 2. Re: Classloader Issue?
            hans.neber

            I now added a jboss-app.xml to the ear's META-INF, with the following content:

            <jboss-app>
             <loader-repository>mycompany.com:loader=myear.ear</loader-repository>
            </jboss-app>


            However, when deploying the ear, I now get:

            15:30:41,322 ERROR [Engine] StandardContext[/mycontext]: Exception starting filter MyFilter
            java.lang.NoClassDefFoundError: org/apache/commons/logging/Log
            at com.mycompany.filter.MyFilter.init(PrincipalFilter.java:156)


            event though the commons-logging package is contained in the ear's war as well as in the ear's jar.

            Any help on how the loader-repository must be configured correctly would be appreciated.