- This topic has 5 replies, 2 voices, and was last updated 17 years, 10 months ago by Riyad Kalla.
-
AuthorPosts
-
Paolo DentiMemberHi,
i cannot understand how to do the following thingtrying 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
Riyad KallaMemberIt 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.
Paolo DentiMemberThanks 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.
Paolo DentiMemberok, 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.
Paolo DentiMembernew 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.jarit works. I such a way, i just need to update the otherLib.jar in the EAR root
thanks
Riyad KallaMemberBingo, you got it with that last post. Common code goes into root of EAR and classloader will take care of letting them load it.
-
AuthorPosts