Questions tagged [war]

Web Application Archive - Is 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

3608 questions
497
votes
14 answers

Difference between jar and war in Java

What is the difference between a .jar and a .war file? Is it only the file extension or is there something more?
helpermethod
  • 51,037
  • 60
  • 165
  • 263
355
votes
12 answers

How to deploy a war file in Tomcat 7

I have copied the sample.war file into the webapps directory of Tomcat, and I can access localhost:8080. Now how will Tomcat deploy it, I mean do I need to open it in browser? How can I access the application?
John
329
votes
19 answers

"webxml attribute is required" error in Maven

I am getting the following error: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) I have got web.xml in right place which is projectname\src\main\webapp\WEB-INF\web.xml What could…
user617966
  • 4,315
  • 4
  • 21
  • 24
189
votes
5 answers

What is WEB-INF used for in a Java EE web application?

I'm working on a Java EE web application with the following source code directory structure: src/main/java <-- multiple packages containing Java classes src/test/java <-- multiple packages containing JUnit…
Steve Chambers
  • 31,993
  • 15
  • 129
  • 173
142
votes
6 answers

IntelliJ and Tomcat....changed files are not automatically recognized by Tomcat

I am running Intellij Ultimate with Tomcat and deploy a war. Everything deploys fine to the webapp directory of tomcat. When I change a file like an xhtml file, is there a way for tomcat to automatically pick up that change? As of right now I…
Peter
  • 1,537
  • 2
  • 10
  • 17
135
votes
16 answers

How to start jenkins on different port rather than 8080 using command prompt in Windows?

I have jenkins.war and I started it from command prompt in Windows as: java -jar jenkins.war It was started well and easily browsed as http://localhost:8080 I want to start on 9090 port. How can I do that?
user2027659
106
votes
14 answers

Oracle JDBC ojdbc6 Jar as a Maven Dependency

I cannot seem to get Maven to bundle the ojdbc6.jar file into my project's war file. I have it working within the POM file when specifying a dependency directly for Hibernate tools. But it won't get bundled with the project's war file, and…
Marvo
  • 16,808
  • 8
  • 46
  • 69
99
votes
3 answers

How do I update a Tomcat webapp without restarting the entire service?

I'm new to Tomcat. We have a dev machine with about 5 apps running. Even though it's dev, it's used by our clients pretty heavily during testing. So say we need to make one small change on one class file. Right now, we have to shutdown Tomcat…
cbmeeks
  • 10,718
  • 18
  • 79
  • 134
98
votes
13 answers

Update Jenkins from a war file

I have a machine with Ubuntu 12.04 and have installed Jenkins ver. 1.424.6 using apt-get based on this guide, but there is a new version: New version of Jenkins (1.447.2) is available for download (changelog). If I press download, I get a…
u123
  • 12,921
  • 42
  • 141
  • 247
96
votes
13 answers

How to create war files

What are the best practices of creating war files (using eclipse) to run on tomcat? tutorials, links, examples are highly appreciated.
ultraman
93
votes
5 answers

Linux command for extracting war file?

How can I extract a .war file with Linux command prompt?
ammar
  • 1,163
  • 3
  • 10
  • 13
90
votes
1 answer

Advice deploying war files vs executable jar with embedded container

There seems to be a current trend in java space to move away from deploying java web applications to a java servlet container (or application server) in the form of a war file (or ear file) and instead package the application as an executable jar…
Brice Roncace
  • 8,771
  • 7
  • 54
  • 64
82
votes
5 answers

Maven WAR dependency

I am writing a project for acceptance testing and for various reasons this is dependent on another project which is packaged as a WAR. I have managed to unpack the WAR using the maven-dependency-plugin, but I cannot get my project to include the…
deelo55
  • 1,121
  • 2
  • 12
  • 9
77
votes
10 answers

How do I run a class in a WAR from the command line?

I have a Java class which has a main and I used to run as a standalone app from the command line e.g. java -jar myjar.jar params I needed to repackage the code to run under apache and all my code, including the entry point class from the old jar,…
Simon
  • 70,546
  • 25
  • 83
  • 117
65
votes
6 answers

Advantages/Disadvantages to exploded WAR files

An answer to a question I read today suggested deploying an application as an exploded (unzipped) WAR. It got me thinking. Every deployment I've ever done to a JBoss/Tomcat has been with a a WAR/EAR file. At least as far as I can remember. Have I…
Kevin D
  • 3,484
  • 1
  • 17
  • 37
1
2 3
99 100