1 Reply Latest reply on Feb 22, 2007 11:01 AM by peterj

    Share classes between multiple web applications

    dgiscool

      I'm using JBoss 4.0.3. I've two web applications deployed where I want to access some of the methods exposed by one web app from another web app. I get NoClassDefFoundError when I try to access a class in \WEB-INF\classes directory of another web application. Is this thing possible at all?

      I know one thing I can do is to put all the class files in \server\deploy\lib directory and then they would probably be accessible to all the web apps. However, I don't want to do that. I tried setting "UseJBossWebLoader" attribute in the jbossweb-tomcat41.sar/META-INF/jboss-service.xml to "true" which I thought would work but in vain.

      I know that design wise this is not a recommended approach and all web apps should be a self-contained deployment. However is this thing possible and how? Please help.

      Thanks
      Deep

        • 1. Re: Share classes between multiple web applications
          peterj

          Try this: move the classes you want to share to a separate jar file and place the jar file in the deploy directory. (I know this works if the jar contains EJBs along with the other classes, haven't tried it without EJBs.)

          The other, and probably better, possibility is to create an ear file containing the above jar file and both of your war files.