The moose likes EJB and Other Java EE Technologies and the fly likes Two WAR files to an EAR Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "Two WAR files to an EAR" Watch "Two WAR files to an EAR" New topic
Author

Two WAR files to an EAR

Ramu Nur
Greenhorn

Joined: Aug 21, 2010
Posts: 19
Hi
We have to create an EAR file that should have two WAR files. But these two WAR files share common application libraries. The two WAR files are build and added to EAR. When this EAR is deployed, the common classes are loaded twice resulting in duplicate schedulers. How can these common libraries be loaded only once? should they be removed from one WAR file?

Thanks in adv
German Gonzalez-Morris
Ranch Hand

Joined: Nov 16, 2009
Posts: 37

move those libraries at ear file level.
so both web applications can load from there.


http://devwebcl.blogspot.com/
Ramu Nur
Greenhorn

Joined: Aug 21, 2010
Posts: 19
Thanks for reply. So, should the common jars go to WEB-INF\lib of EAR file? I know EAR has a META-INF, applicatoin.xml.
German Gonzalez-Morris
Ranch Hand

Joined: Nov 16, 2009
Posts: 37

you can try leave them in the root of the ear file.
ear file doesn't have a WEB-INF, only war files.

If you are using WebLogic then the jars can go into /APP-INF/lib (this is in the root of the ear file)
Ramu Nur
Greenhorn

Joined: Aug 21, 2010
Posts: 19
ABC.ear
- application.xml
- meta-inf
- xyz.war
- 123.war
- common1.jar
- common2.jar

Is it this way?
German Gonzalez-Morris
Ranch Hand

Joined: Nov 16, 2009
Posts: 37

yes.

anyway which app container are you using ?
Jaikiran Pai
Saloon Keeper

Joined: Jul 20, 2005
Posts: 6720

Please do not create multiple threads for the same question. I'm closing the other one http://www.coderanch.com/t/562508/EJB-JEE/java/Two-WAR-files-have-common.

[My Blog] [JavaRanch Journal]
Ramu Nur
Greenhorn

Joined: Aug 21, 2010
Posts: 19
This is for jboss. The actual problem is, there are some dao classes and quartz schedulers in those common jars. they are started when war is deployed. If they are common, when two wars are deployed, the schedulers, dao connections etc are loaded twice. I want to avoid that.

any clues?
Jaikiran Pai
Saloon Keeper

Joined: Jul 20, 2005
Posts: 6720

Ramu Nur wrote: I want to avoid that.

any clues?


Did you read the replies in the other thread?
Andrew Moko
Ranch Hand

Joined: Dec 16, 2011
Posts: 55
Why don't you configure your project with maven. You just need to add dependencies to your application project and maven handles everything else..
Jaikiran Pai
Saloon Keeper

Joined: Jul 20, 2005
Posts: 6720

rajesh yedula,
Your post was moved to a new topic.
 
 
subject: Two WAR files to an EAR
 
Threads others viewed
Order in which class is searched
[JBoss 6.0 M2] Best approach to build and deploy an EAR archive
What is an EAR?
Deploying My project in Jboss server
Loading multiple log4j.xml files
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com