This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

What's the point of an ear file?

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please explain to me what advantages are provided with the creation of a .ear file as opposed to a .war or an ejb.jar? Thank you.
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ears are a standardized way of packaging and deploying applications that make use of J2EE components. It allows one to keep all of the ejb-jars and wars together as a cohesive unit and goes to some length to define how classes are shared among the components, though the specification still needs work here as anyone who has had to deal with J2EE Classloading pains can attest.
Using ears are much easier than separately deploying and configuring multiple J2EE components and dealing with the even greater class sharing headaches that result from this.
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A coworker of mine created a .ear file with some servlets and ejbs inside it. I have created my own .war files that use ejbs from the .ear file. Is this a strange configuration? Should I instead create a .ear of my own and put his ejb.jar file inside it?
Recently, my coworker did a hot deploy of his .ear file on JBoss and the servets in my .war file could no longer get valid references to the ejbs in the .ear. However, my coworker's servlets worked fine with the ejbs since they were placed inside the same .ear. Should I change the way I am using his ejbs? If so, how? Thanks.
 
author
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Anthony Watson:
A coworker of mine created a .ear file with some servlets and ejbs inside it. I have created my own .war files that use ejbs from the .ear file. Is this a strange configuration? Should I instead create a .ear of my own and put his ejb.jar file inside it?
Recently, my coworker did a hot deploy of his .ear file on JBoss and the servets in my .war file could no longer get valid references to the ejbs in the .ear. However, my coworker's servlets worked fine with the ejbs since they were placed inside the same .ear. Should I change the way I am using his ejbs? If so, how? Thanks.


Anthony,
Your packaging is wrong.
Your coworker can access the ejbs from his servlets because they reside in the same ear (and hence they have a class loader hierarchy. One is visible to the other)
In your case, you are trying to access the ejbs in his/her ear. For that to work, you need to bundle just the remote and home interfaces of those EJBs in your WAR.
I could go on and on about how to package J2EE classes and dozens of deployment considerations and impact of classloader hierarchy on deployment, but I strongly suggest you should read the sample chapters from "J2EE Project Survival Guide" - a book that I am currently authorng. I bet all your questions regarding classloading and deployment will be answered. The beta chapters are available for free at ServerSide:
Free Chapters on J2EE Classloading and deployment
Srikanth Shenoy
Author: Struts Survival Guide
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic