wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes .jar or .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 ".jar or .ear ?" Watch ".jar or .ear ?" New topic
Author

.jar or .ear ?

Frank Sikuluzu
Ranch Hand

Joined: Dec 16, 2003
Posts: 116
New to EJB. Couple of simplest questions ---

I know if I have a web application, I put everything in a .war file. If

1. my application is an EJB without any web application, should I put everything in a .ear or a .jar ?

2. my application is an EJB including web application, should I first put the web application in a .war, then combine the .war with the EJB classes and others into a .ear or into a .jar ?

please kindly answer separately for above scenarios.

thanks,
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

Frank,
1. It depends on how you are going to deploy it. If you are deploying the EJB as an application, put it in an .ear. If you are giving it to someone else to use, put in a jar. Note that this special type of jar is called and ejb jar.
2. Yes, put the web app in a war first. Then put the ejb in a jar. Finally, put both in an ear.


[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
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
1. my application is an EJB without any web application, should I put everything in a .ear or a .jar ?


By default of EJB , you can packaged into jar file.

And you can packaged into EAR file.

EAR file
- application.xml
- jar file
- META-INF / ejb-jar.xml
- war file
- WEB-INF / web.xml


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
2. my application is an EJB including web application, should I first put the web application in a .war, then combine the .war with the EJB classes and others into a .ear or into a .jar ?

Both, depend on you and requirement.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: .jar or .ear ?
 
Similar Threads
Accessing common jar files in EAR
Is it wrong to place EJB jars in a WAR file?
How to make a WAR file for EJB project in WSAD
Packaging and Class Loaders
Jar in the build path of web and EJB application