• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

no "war" file created when we deploy a servlet through tomcat ?  RSS feed

Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is that correct that there is no "war" file created when we deploy a servlet through Tomcat ?

.. then why it created when we use sun deployer tool ?
Author and all-around good cowpoke
Posts: 13078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deploying a web application by means of a WAR file is optional.

Creation of a WAR can be done by your IDE or a separate tool, Tomcat has nothing to do with creation of a WAR.

Posts: 20314
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dang it Bill, Now you've gone and made me RTFM!

This is what the JEE 5 spec says about deployment in Section EE.8.4 (Deployment)

Any Java EE product must be able to accept a Java EE application delivered
as a .ear file or a stand-alone Java EE module delivered as a .jar, .war, or .rar
file (as appropriate to its type).

I think that what Abhay was originally asking wasn't really why is no WAR file created, but why no exploded WAR directory was created. Not totally certain, because he was asking about things as though they occurred in the opposite order that they really do.

Tomcat, as well as quite a few other appservers, allows deployment of webapps in "Exploded WAR" format, which is simply the set of directories and files you'd get if you unZIPped a WAR file. Since Tomcat isn't full-stack, it doesn't deal in jar, ear or rar deployables, so I won't mention them further.

However. this is just a convenience. Nowhere in the JEE spec will you find reference to exploded WARs. Officially, to be deployable, a JEE webapp has to be a single WAR file (or EAR, or whatever). Furthermore, Tomcat is under no obligation to actually explode deployed webapps. The option is turned on by default, but it can be turned off or even not done because of how the war was deployed, and I do have some production webapps that don't explode their WARs, in fact.

So just to set the record straight:

A. Tomcat, like other JEE webapp servers does not produce, WARs, it consumes them (as you pointed out). Furthermore, it can work with WARs in their original form, explode them, or accept them in pre-exploded form.

B. IDEs and build utilities such as Ant and Maven can build deployable WARs. I'm not familiar with the Sun deployer tool, but assuming that it lives up to its name, the Sun deployer tools would not be building WAR files, it would be consuming them, bundling them with their corresponding appserver-specific deployment descriptor (if needed), and then forwarding the results through a suitable deployment mechanism (such as JSR-88) into Tomcat. Whether Tomcat then explodes the deployed WARs, like I said, is ultimately Tomcat's decision, although it's possible that the Sun deployer tool's specific deployment processes influence Tomcat's decision.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!