Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes class conflict in jar and war Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "class conflict in jar and war" Watch "class conflict in jar and war" New topic
Author

class conflict in jar and war

Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
When we prepare a war ,We have some classes which are go into the war as well as the jar(to be kept in ejb tier)When thsi EAR is deployed on Weblogic7.0 and the class is accessed then at runtime this gives 500 internal server error. Can anybody pl tell why?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You should take a look at WebLogic's log files. The HTTP 500 error you're seeing in your browser would indicate that someone threw an exception and it's probably logged somewhere...


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
actually all this problem is because we do not know how to package third party jars along with the ear . It is simple if the war uses them ,we can simply place them ine WEB-INF/lib , but what when they are needed by the ejb tier classes.
PL help
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

http://www.theserverside.com/resources/articles/J2EE-Deployment/chapter.html


Groovy
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Ah, you need to add the "utility" .jar file into the .ear file next to your .wars and .jars and then add a "Class-Path:" manifest entry into each "mywebapp.war" and "myejb.jar" that needs to use the utility classes.
Take a look at this article (search for "better solution"...)
Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
we have tried that but still the problem remains. do we need to make any entries in the application.xml
the structure is as follow
App.ear :
a.war
b.jar
util1.jar
util2.jar
in b.jar's manifest.mf we have entires Class-Path: util1.jar util2.jar
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Lasse is correct. Hopefully this article from TheServerSide helps:
Understanding J2EE Application Server Class Loading Architectures
Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
if a class(cacheloader) is present in both the war and ejb-jar but is used only by the web classes will the server give any error
With the fact that this class uses a third party jar which IS present in WEB-INF/lib but not in ejb-jar dependent's
Pls note that this class is never instantiated in the ejb container hence would never require the third party jar.
I am using weblogic7
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

The class-path entry should be in the manifest files of war and ear files rather than b.jar.

Originally posted by Monmohan Singh:
we have tried that but still the problem remains. do we need to make any entries in the application.xml
the structure is as follow
App.ear :
a.war
b.jar
util1.jar
util2.jar
in b.jar's manifest.mf we have entires Class-Path: util1.jar util2.jar
Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
okay, will we need in war also ( since we are keeping the jars in WEB-INF/lib)
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

okay, will we need in war also ( since we are keeping the jars in WEB-INF/lib)

It is better to put the common jar files outside of ear and war.
Monmohan Singh
Ranch Hand

Joined: Aug 02, 2002
Posts: 82
just now I have tried it.Now it is not able to load the properties files in web ( they are placed at WEB-INF/classes)
do we need to place them as well in the ear and put the .properties in the classpath entry in manifest.mf??
 
 
subject: class conflict in jar and war