• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

Bill
 
Saloon Keeper
Posts: 27764
196
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
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.
 
Don't listen to Steve. Just read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic