2 Replies Latest reply on Jan 23, 2003 11:56 AM by djolly

    Classpath question involving multile webapps

    djolly

      Is it possible in Jboss 3.x to configure a webapp such that if a needed .class file is not it classes directory, (or in a .jar from the /lib dir) the classloader will look into the classes directory of a second webapp?

      For example, webappA tries to load class1.class. The classloader uses the version in webappA.war/WEB-INF/classes if the file is there, but uses the version in webappB.war/WEB-INF/classes directory otherwise.

      Is this possible?

      Thanks in advance.

        • 1. Re: Classpath question involving multile webapps
          mlindhout

          Hi,

          If two webapps need to share the same code, you should place that code in a separate jar file, package it at the ear level and provide a MANIFEST.MF file in the META-INF (*Not* the WEB-INF) of the two webapps. This file should look like this (excluding the dashes and including the last empty line):

          --------------------
          Manifest-Version: 1.0
          Class-Path: shared.jar

          --------------------

          I'm not sure its in one of the x specifications, but most appservers first use the WEB-INF/lib to search for classes. If not found, the search one of the other class locations.

          • 2. Re: Classpath question involving multiple webapps
            djolly

            Thanks. What you described is exactly right. But what I'm trying to do is specify a classes directory as opposed to a jar file. I tried to do what you suggested but with only a directory specified, but that didn't work.