Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

questions about EARs and Assembling and deploying multiple web applications

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All,
I need multiple web applications to a single server. None of these applications currently utilize any EJBs, just servlets, beans, and jsps. Would it be appropriate to jar these web applications (war files) into a single ear for deployment? If so, how is it possible to have them 'share' a single jar, if that is indeed possible? If any of my assumptions appear erroneous, please let me know. I am still n ot entirely clear on what the purpose/advantages of a ear file is.
Thanks in advance,
-MLA
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can place multiple WAR's in a single EAR. That way they can share several "utility" JAR files placed in the root directory of the EAR (so things like Log4J, etc. could be shared).
Kyle
 
Michael Arnett
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the info Kyle. One other question: Is it possible to have classpath elements relative to the server's root directory, rather than relative to the ear's root directory or the web application's root directory?
Thanks again,
-MLA
 
Saloon Keeper
Posts: 25794
184
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Arnett:
Thanks for the info Kyle. One other question: Is it possible to have classpath elements relative to the server's root directory, rather than relative to the ear's root directory or the web application's root directory?
Thanks again,
-MLA


That would require knowing about the internal structure of the appserver and violate the portability of the webapps. And, in extreme cases, wouldn't even exist.
For example, I run JOnAS for EJBs, Tomcat for servlets/JSPs and Apache for the front-end. The Tomcat components are placed in OS binary directories, not in a special directory all their own. So what would be the "server directory???"
If you do need such creatures, the best way to map them is via an environment definition. But make sure you really do need them!
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree - in general, I would keep any JARs that you need wrapped up inside the EAR or WAR files as it makes deployment and manageability much, much easier.
Simon
 
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic