This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Access Project Utility Jar which is outside of WebContent\WEB-INF\lib from web proj packaged as EAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Access Project Utility Jar which is outside of WebContent\WEB-INF\lib from web proj packaged as EAR" Watch "Access Project Utility Jar which is outside of WebContent\WEB-INF\lib from web proj packaged as EAR" New topic
Author

Access Project Utility Jar which is outside of WebContent\WEB-INF\lib from web proj packaged as EAR

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
An EAR file (e.g. MyProj.ear) contains the following:
1. MyWebProj.war as a module
2. MyUtilProj.jar as a Project Utility Jar.

Now, MyWebProj.war calls classes from the jar file that are available under MyUtilProj.

In the development environment, the WebContent\WEB-INF\lib folder of MyWebProj does not physically contain the needed jar file that are in MyUtilProj. Instead, the MyWebProj.war has build-reference to MyUtilProj. MyWebProj compiles successfully and references the classes found in MyUtilProj.

When MyProj.ear is deployed, the MyWebProj can not find the jar files inside MyUtilProj.jar, even though MyUtilProj.jar is available as a Project Utrility jar in Myproj.ear. The deployment of MyProj.ear fails.

Obviously, the deployment would have been successful if the required jar files were physically copied in WebContent\WEB-INF\lib folder of MyWebProj.

But my goal is to be able to read the jar files (as present in MyUtilProj) from MyWebProj by not physically copying them again under WebContent\WEB-INF\lib folder of MyWebProj.

Is there any way to successfully deploy MyProj.ear by NOT physically copying the jar files from MyProjUtil in the WebContent\WEB-INF\lib folder of MyWebProj?

I am using WebSphere 6.1 test server as the application server.
Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
As a note, I tried shared library approach, which did not work and did not deploy the EAR file either.

In the META-INF\MANIFEST.MF, I see the relevant jar files from MyUtilProj. I check the ones I need and save the MANIFEST.MF. The checked jar files never get saved. I am not sure why I can not save this MANIFEST.MF, after I have modified them. Manually additing the jar files on the source view of MANIFEST.MF does not save the file either.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30050
    
149

Sam,
I think you may need to change the classloader settings in the admin console. The deployed ear contains your project utility jar all jar'd up and in the EAR project. A web project is able to read from there.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access Project Utility Jar which is outside of WebContent\WEB-INF\lib from web proj packaged as EAR
 
Similar Threads
Sharing External Jar files between projects
question regarding packaging utility jars
JBoss class path issue
Getting a headage..... Cannot find class [...] for bean with name '...' defined in ServletContext re
META-INF?