4 Replies Latest reply on Oct 7, 2003 6:55 AM by Lewis Henderson

    EJB/EAR Class-Path issue?

    Lewis Henderson Novice

      I have an EAR containing an EJB.jar and a.jar, b.jar. If I add a.jar to the EJB.jar's manifest classpath, it works as expected. However a.jar requires b.jar in it's manifest classpath. If I set this up, the b.jar is not loaded and I get CNF exceptions. (I don't think that I should have to add b.jar to the EJB's classpath!)

      Should the tree of classpaths be cascaded down through the jar's?

      Kind regards


        • 1. Re: EJB/EAR Class-Path issue?
          Bernd Zeitler Expert

          Since only EJB jars need the Class-Path entry, you have to enter every dependent .jar there (not only direct dependencies).
          It should work with JBoss even without declaring the Class-Path at all, since all the .jars share the same loader repository.


          • 2. Re: EJB/EAR Class-Path issue?
            Lewis Henderson Novice

            I need to put the jars in the EJB class-path as I am following the spec. I do not want to rely on JBoss features (although JBoss is the server that I'm using for this customer).

            My point is that the referenced jars also have a Class-Path entry (which also follows the JAR spec) and so, in theory at least, their referenced jars should also be added to the EJB's classpath...


            P.S. When I do not add the jars to the EJB class-path, I get CNF exceptions (As I would expect)

            • 3. Re: EJB/EAR Class-Path issue?
              Raja Master

              Well, i dont think the cascade effect works here. Because if u are considering EJB.jar and having a.jar in its manifest classpath, you can have the classes in "a" loaded using the Classloader for EJB.jar. If a.jar needs b.jar, the classloader for ejb.jar needs to find those classes, which it cannot, if you dont have b.jar in its classpath.
              I dont think this is a jboss specific feature.


              • 4. Re: EJB/EAR Class-Path issue?
                Lewis Henderson Novice

                The 'JBoss specific feature' that I was refering to was the repository, not the Class-Path cascade.

                I think that the EJB.jar classloader *should* recurse it's Class-Path and the classpaths of the referenced JARs... (a.jar in this case)