Questions tagged [war]

Web Application Archive - Is a JAR file used to distribute JavaServer Pages, Java Servlets, Java classes, XML files, tag libraries and static Web pages (HTML and related files) that together constitute a Web application.

In software engineering, a WAR file (or Web application ARchive) is a JAR file used to distribute a collection of pages, Java , classes, files, tag libraries, static web pages ( and related files) and other resources that together constitute a web application.

A WAR file may be digitally signed in the same way as a file in order to allow others to determine what source the code came from.

There are special files and directories within a WAR file.

The /WEB-INF directory in the WAR file contains a file named web.xml - the Web Application Deployment Descriptor - which defines the structure of the web application. If the web application is only serving JSP files, the web.xml file is not strictly necessary.

If the web application uses servlets, then the servlet container uses web.xml to ascertain to which servlet a URL request will be routed to. web.xml is also used to define context variables which can then be referenced within the servlets.

Environmental dependencies which the deployer is expected to set up can also be defined in this file. An example of an environmental dependency is a dependency on a mail session used to send email. The servlet container is responsible for providing this service.

Useful links

3745 questions
68
votes
7 answers

In Maven, how output the classpath being used?

For my current purposes I have a Maven project which creates a war file, and I want to see what actual classpath it is using when creating the war. Is there a way to do that in a single command -- without having to compile the entire project? One…
Alexander Bird
  • 38,679
  • 42
  • 124
  • 159
67
votes
9 answers

How to extract .war files in java? ZIP vs JAR

I have a web program where I want the user to be able to import a .war file and I can extract certain files out of the .war file. I have found two class libraries: java.util.zip.* and java.util.jar.*. From what I understand, a WAR file is a…
user972276
  • 2,973
  • 9
  • 33
  • 46
65
votes
14 answers

Appending files to a zip file with Java

I am currently extracting the contents of a war file and then adding some new files to the directory structure and then creating a new war file. This is all done programatically from Java - but I am wondering if it wouldn't be more efficient to copy…
Grouchal
  • 9,756
  • 6
  • 34
  • 46
64
votes
3 answers

Deploying Java webapp to Tomcat 8 running in Docker container

I am pretty new to Tomcat and Docker - so I am probably missing a Tomcat fundamental somewhere in this question. What I am trying to do is build a Docker container that runs a SpringBoot Restful web service that just returns some static data. This…
Chris
  • 919
  • 2
  • 7
  • 11
58
votes
7 answers

Differences between jar and war in Spring Boot?

I'm about to build my first website in Java with Spring Framework using Spring Boot and it's much easier to build it in jar, but I have a few questions about it. What are the differences in general? In jar files the views are under…
Hama Saadwn
  • 743
  • 2
  • 9
  • 16
56
votes
7 answers

How To Integrate Clojure Web Applications in Apache

Note Given this OP was written about two years ago, rather than ask the same question again, I am wondering if step-by-step instructions exist, so that I can integrate a Noir or other Clojure web application into Apache, whether it's Jetty, Tomcat,…
futlib
  • 8,258
  • 13
  • 40
  • 55
56
votes
8 answers

How to unpackage and repackage a WAR file

I have a WAR file. I would like to open it, edit an XML file, remove some jars and then re-package it. I used WINRAR to open the WAR file and I removed some Jars and did an 'Add to Archive' in WinRar and created a WAR. When I deployed the WAR in…
Vinoth Kumar C M
  • 10,378
  • 28
  • 89
  • 130
52
votes
9 answers

Executable war file that starts jetty without maven

I'm trying to make an "executable" war file (java -jar myWarFile.war) that will start up a Jetty webserver that hosts the webapp contained in the WAR file I executed. I found a page that described how to make what I'm looking for: However, following…
twilbrand
  • 1,330
  • 5
  • 19
  • 27
50
votes
6 answers

Java EE Containers vs Web Containers

I'm relatively new to Java EE/EJB, and I've been reading a lot regarding Java EE containers. I've had experience working with a web container (WAR file in JBoss). I am also aware that JBoss can also be used as a Java EE container. What is the…
mel3kings
  • 8,857
  • 3
  • 60
  • 68
47
votes
1 answer

How to make war file in Eclipse

What is the easy way to make war file? My project is working when i right click run on server, but i want to deploy on tomcat server. I have installed m2clipse but it gave me an error. Is maven compulsory to make war file? Do i need special…
John
47
votes
5 answers

Jetty Run War Using only command line

Is it possible to use only the command line to Run jetty with only a specified war file and Context Path. Something like : java -jar $jettyHome/start.jar -Dwar.location=myApp.war -DcontextPath=/myApp OPTIONS=default,plus,jsp
gbegley
  • 2,609
  • 5
  • 29
  • 41
43
votes
7 answers

Unable to find a javac compiler

I am trying to package my web application into war file using Ant. When I build, I am getting the following error: C:\Documents and Settings\Administrator\workspace\Assignment7\build.xml:67: Unable to find a javac compiler; com.sun.tools.javac.Main…
Sarin Jacob Sunny
  • 2,138
  • 3
  • 29
  • 61
43
votes
4 answers

deploying multiple applications to Tomcat

I want to deploy two applications foo.war and bar.war to the same Tomcat instance. Is it possible for them to listen for connections on different ports, e.g. foo listens on port 81 and bar listens on port 82? If so, how can I configure this? I…
Dónal
  • 185,044
  • 174
  • 569
  • 824
40
votes
4 answers

Does Tomcat require Apache httpd?

If I am given a war file that contains a Java web application, and I want to run that war locally, then do I just need Tomcat, or do I need Tomcat and Apache httpd (or any other web server)? Thanks in advance!
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
40
votes
8 answers

How to deploy war file to tomcat using command prompt?

I have created a war file and put into tomcat/webapps. How to deploy a war file to tomcat using command prompt?
user3607853
  • 403
  • 1
  • 5
  • 7