What is an EAR file? I need to transfer a Web app in a WAR nested in an EAR to another server running Apache Tomcat. What do I have to do?
Welcome to acronym hell. Sometimes I wonder if this whole Java/J2EE thing would have failed miserably, had it not been for the availability of the A-R-chive acronym derivatives. As you breeze through literature and Web sites that discuss Java and J2EE, you will see such acronyms as RAR, WAR, JAR, EAR, and possibly even TAR. I predict that someday, Java and J2EE will enable you to jump in a CAR, drive to the BAR, get in a WAR discussing PAR, hit somebody with an OAR and then turn and run FAR. Where's my rimshot? But seriously folks...even if you are unfamiliar with any of the other extensions, you more than likely have encountered a file with a .jar extension or a discussion of JAR files.
Files with a .jar extension or JAR files, are essentially just a collection of files compressed using the ZIP/ZLIB compression format. JAR (short for Java Archive) files were introduced in the early days of Java as a means to conveniently package and distribute Java applications and components. Since then, a number of additions to the Java platform have followed suit. The introduction of the EAR file is one such addition.
An EAR (Enterprise Archive) file is a JAR file that contains a J2EE application. A J2EE application is a group of Web modules that collectively perform as a single entity. A Web Module is an entity consisting of one or more resources such as HTML files, Java class files, XML files, etc. Web Modules are packaged in Web Archive (WAR) files. Looking at it from a top-down view, EAR files contain JAR files and WAR files. Packaging resources in WAR files, JAR files and eventually EAR files, makes it easy to reuse and reassemble components as new J2EE applications and distribute them to new environments.
Tomcat is a servlet/JSP container available from the jakarta.apache.org site. Tomcat deals only with WAR files. So, in order to auto-deploy a Web application to a Tomcat environment, you must place an application's WAR file in the appropriate directory or use Tomcat's deployment tools to manually deploy the file. If you already have an EAR file that contains the WAR file, you can extract the WAR file and use it as is. If you do not have the EAR file or the WAR file, you can use any number of compliant tools to create the WAR file. The following sites discuss the Tomcat deployment process in detail:
Dig Deeper on Java Web Services
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.