on 08-08-2008 3:09 PM
Netweaver 7.0, WEBAS 640:
I have an EAR I am deploying containing an EJB and a webapp. I have third party jars that I need to use from both the EJB and webapp, and so want to just package in as part of the EAR. I do not want to fuss with deploying the third party jars separately, nor do I want to duplicate them into the EJB and WAR separately...
I have the jars in the root of my EAR project, and have the build path set up in NWDS for the EJB and WAR so that the jars are referenced, so I'm ok at build time...
...but I'm getting NoClassDefFound exceptions for the classes in the 3rd party apps when I go to run them.
What do I have to do in my EJB and WAR projects to be able to see the third party jars in the EAR at runtime?
Hi Douglas,
Is your problem resolved?
Can you give your EAR deployment structure.
Try to put third party jar files under lib folder under the EAR root directory.
If you are using these files in web app only put them under lib folder under WEB-INF folder.
Rama Murthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
problem is not resolved.
my EAR was structured with the third party jars at the root of the EAR. I have also taken your suggestion, created a lib folder inside the ear project, and moved the third party jar to that folder, but the problem persists. I have not done any changes to any descriptors to go with these changes.
I saw a forum post or help entry that recommended putting a Class-Path: entry inside WEB-INF/manifest.mf, but that does not help either. I have tried both manifest.mf and MANIFEST.MF.
as a workaround, I am running with individual copies of the third party jars in the WEB-INF/lib of the web app, and in the META-INF/lib of the EJB. The web application works, but it causes me to deploy the jars twice, and I still cannot use third party jars in the EJB project (it can't find the third party jars, even if I put them in META-INF/lib; I need to do some more research there).
Hi,
<module>
<java>
<uri>abc.jar</uri>
</web>
</module>
Try putting this in application.xml.
The best option for such type of problem is creating a APP-INF folder under the root.
Sample structure:
ear
APP-INF
classes -- put all class files and properties files
lib -- put all jar files
war
ejb-jar
Try with this structures. Put all the jar files under APP-INF/lib folder, and the application class loader will pull all the classes and properties from classes and lib folder.
NOTE: I am not sure this folder is recognised in EP server. Weblogic recognises this folder.
Try this once.
In EP server the recommendation is to create j2ee library projects and refer them in the project descriptor files. By specifying thus the server will load them in the application class loader.
Rama Murthy
Hi Douglas,
Please verify that the 3rd party jars are indeed packaged inside the EAR file. If that is the case, there should be no problem to load classes from them.
Also, NoClassDefFoundError is usually thrown when an attempt is made to load some class A and it depends on some other class B but has no access to its definition at runtime, which results in NoClassDefFoundError for B. If the definition of A could not be found, you would get a ClassNotFoundException for A. So it's important to check all classes that are involved in the scenario. Normally, you would be able to obtain some hints from the error message / stack trace.
HTH!
\-- Vladimir
P.S.: JAR files are not like WAR files and don't have the META-INF/lib concept.
First of all, <module> <java> defines an application client module and has no <uri> child element.
Also, according to the J2EE spec there's no such thing as APP-INF. This seems to be something WLS specific.
By EP server I guess you refer to NetWeaver AS Java, aka Web AS Java, aka J2EE Engine. The recommendation for J2EE library projects (currently in versions <= 7.0) is for the case when the library jars would be used by more than one J2EE application. Otherwise, in the single app scenario, packaging the jars within the app EAR is an absolutely valid solution.
Vladimir: we are getting close; the jars are not in the EAR. They are in the EAR project in NWDS, but not in the .ear file that gets built:
Archive: ../JarTest.ear.ear
inflating: META-INF/MANIFEST.MF
inflating: META-INF/SAP_MANIFEST.MF
inflating: META-INF/sda-dd.xml
inflating: JarTest.war.war
inflating: META-INF/application-j2ee-engine.xml
inflating: META-INF/application.xml
what do I need to do to get NWDS to include the jars?
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.