facebook

problem deploying dependent projects

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #264584 Reply

    Paolo Denti
    Member

    Hi,
    i cannot understand how to do the following thing

    trying to simplify …
    – i have a ear project
    – the ear project contains
    — 1) a jar module
    — 2) a war module
    – the jar module contains a class A that depends on a class B contained in a jar file (let’s say j.jar)
    – a jsp in the the war module uses the A class (therefore depends on the j.jar file)

    everything compiles without errors but, during deployment, the j.jar file is not deployed and therefore the jsp cannot find class B.

    the j.jar file is “enabled/checked” in the “java build path – order and export tab” but it does not help.

    how can i force the j.jar file to be deployed ?

    thanks

    #264596 Reply

    Riyad Kalla
    Member

    It sounds like your hierarchy is like this:

    
    + EAR
      + WAR
        + Java Project (Class A)
          + JAR (Class B)
    

    If that’s the case, put the JAR that has Class B in the root of your EAR or in your WEB-INF/lib dir in your WAR project, either way will work. Then make sure your WAR is set to deploy it’s dependencies (Project Properties > MyEclipse > Web > Deployment), and then when you deploy the EAR you should be all set.

    #264622 Reply

    Paolo Denti
    Member

    Thanks Ryiad, i tried but it did not work.

    the hierarchy is like this:

    
    + EAR
       + WAR1
          + src: ServletX (using ClassA)
       + WAR2
          + src: ServletY (using ClassA)
       + EJB1
          + src: ClassA (using ClassB)
          + jar: otherLib.jar (containing ClassB and added to build-path, libraries, exported)
    

    i would like to include only once, only in one place, otherLib.jar and having it deployed in WAR1/WEB-INF/lib and WAR2/WEB-INF/lib.

    I tried to set the WAR to deploy it’s dependencies, to copy the otherLib.jar in the ear root but it did not work.
    When i use ServletX or ServletY, i get a very nice ClassNotFound because otherLib.jar has not been deployed.
    Of course, if i copy the jar in the WEB-INF/lib dir, it works but that is exactly what i would like to avoid.

    #264624 Reply

    Paolo Denti
    Member

    ok, more or less i got it.

    i have to add manually otherLib.jar (linked from the EJB1 module) to the build path of WAR1 and WAR2 and it will be deployed to the WEB-INF/lib dir.

    But, what i do not understand is the meaning of “exporting library” otherLib.jar in the EJB1 module . the behavior is the same, exported or not.
    And still i have to manually include dependencies.

    #264629 Reply

    Paolo Denti
    Member

    new option:
    – add otherLib.jar to the top of the EAR
    – add otherLib.jar to the build path of WAR1, WAR2 and EJB1 (referencing the one just added)
    – add the following line to the MANIFEST.MF of WAR1, WAR2 and EJB1
    Class-Path: otherLib.jar

    it works. I such a way, i just need to update the otherLib.jar in the EAR root

    thanks

    #264632 Reply

    Riyad Kalla
    Member

    Bingo, you got it with that last post. Common code goes into root of EAR and classloader will take care of letting them load it.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: problem deploying dependent projects

You must be logged in to post in the forum log in