Creating a.war file W(eb) AR(chive). Creating a.war file The following article may contain actual software programs in source code form. This source code.

Slides:



Advertisements
Similar presentations
Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene.
Advertisements

Developing in CAS. Why? As distributed you edit CAS 3 with Eclipse and build with Maven 2 – Best Practice for Release Engineering – Difficult edit-debug.
Servlets Enterprise Systems Programming. Servlets  Servlets: server-side Java programs that enable dynamic processing of web-based requests  Web-based.
Developing CAS in Eclipse
My First Building Block Presented By Tracy Engwirda 28 September, 2005.
DT228/3 Web Development Introduction to Java Server Pages (JSP)
MC365 Ant. Today We Will Cover: Overview of Ant Installing Ant Using the Ant command line tool Various Ant commands available Using Ant in Eclipse.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Installing JDK and Tomcat Vijayan Sugumaran Department of DIS Oakland University.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
Installing JDK and Tomcat Vijayan Sugumaran Department of DIS Oakland University.
Tomcat Organization Deploying applications. Confusion Like a web server Root locations are from a defined directory location In addition… from that point.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
Jsp. JBoss Many servers (like JBoss and Glassfish) are Tomcat servers. The file structures and format for deployment are the same. Where (in what server.
Apache Tomcat Representation and Management of Data on the Web.
DT211/3 Internet Application Development Web Servers.
Objectives:1. Investigate the Web application deployment descriptor 2. Install and deploy Tomcat and struts 3. Design and deploy a struts application Struts.
Tomcat Configuration A Very, Very, Very Brief Overview.
Coypright (c) Ning Chen, Ph.D CPSC 425 Java Enterprise Application Programming Presented by Ning Chen, Ph.D. Chair/Professor Department of Computer.
Web programming for project students Dr Jim Briggs.
Building and Deploying a Simple Web Application. Tomcat and JSP Tomcat is an application server, commonly used to host JSP applications Applications are.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Julien Thibault / Phil Brewster / Kristina Doing-Harris
Java Servlets and JSP.
Introduction to Java web programming Dr Jim Briggs JWP intro1.
Creating a Hello App Using Google App Engine. What are Google apps? Apps is an abbreviation for application. An app is a piece of software. It can run.
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Web server and web browser It’s a take and give policy in between client and server through HTTP(Hyper Text Transport Protocol) Server takes a request.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Notes of J2EE Tutorial Matt Tsai. 2 Outline Chapter 1: Overview Chapter 1: Overview Chapter 2: Understanding XML Chapter 2: Understanding XML Chapter.
Apache Tomcat Representation and Management of Data on the Web.
Java Servlets CS-422. Application Mapping Your servlet application will be mapped to a directory structure: –“myapp” maps to some directory C:/docs/apps/myapp.
1 CS6320 – Deployment and Context L. Grewe 2 The Servlet Container Servlets run in a container sometimes called the Servlet engine. Servlets run in a.
SchwartzGBIF Nodes III29 April 2003 DiGIR Portal Installation And Configuration.
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
Working With Apache Axis. Axis Information See guide.html for the basic user guide.
JBoss at Work JAW Motors Application Chapter 1-3 Jeff Schmitt October 9, 2006.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
DSpace UI Alexey Maslov. DSpace in general A digital library tool useful for storage, maintenance, and retrieval of digital documents Two types of interaction:
Web Applications - Basics. Introduction to Web Web features Clent/Server HyperText Transfer Protocol HyperText Markup Language URL addresses Web server.
Mark Dixon 1 12 – Java Beans. Mark Dixon 2 Session Aims & Objectives Aims –To cover the use of Java Beans Objectives, by end of this week’s sessions,
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Chapter 7 Using Custom Tag Libraries and the JSP Standard Tag Library.
C HAPTER 11 D EPLOYING YOUR WEB APP. WAR FILE A WAR file is simply a snapshot of your web app structure, in a nice portable, compressed form (it is really.
Topic Java EE installation (Eclipse, glassfish, etc.) Eclipse configuration for EE Creating a Java Web Dynamic Project Creating your first servlet.
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
Deploying a service. Talk titledate2 Talk titledate3 Section SOAP Deployment.
An Introduction to JavaServer™ Pages Prepared by Nicole Swan.
Java Enterprise Edition Programming Page 1 of 9Configuring Servlets Web Application Context Name  In multiple web applications, a “context name” is used.
Chapter 1 Introducing Ant. What is ant? Ant is a build tool  Automate the tasks of compiling code, running test, and packaging the results for redistribution.
17 Copyright © 2004, Oracle. All rights reserved. Deploying an ADF Application.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
 2003 Prentice Hall, Inc. All rights reserved Deploying a Web Application ( may include.war )
Topics to be covered (ni) Client side validation JSF (free tools as well) Webservices Tell Resources e.g. sites Packaging and deploying web applications.
BlueDragon Editions and Advantages Lori Pacheco New Atlanta.
1 Web Programming with Servlets & JSPs WEB APPLICATIONS – AN OVERVIEW.
Deploying Web Applications to Tomcat Server Chun Guo
Advanced Java Programming
Outline SOAP and Web Services in relation to Distributed Objects
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Outline SOAP and Web Services in relation to Distributed Objects
J2EE Application Development
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Java Servlets and JSP.
Presentation transcript:

Creating a.war file W(eb) AR(chive)

Creating a.war file The following article may contain actual software programs in source code form. This source code is made available for developers to use as needed, pursuant to the terms and conditions of this license.license The Reason The new way of deploying Java[tm] 2 Platform, Enterprise Edition (J2EE[tm]) Web modules that include Java[tm] Servlets and JavaServer Pages[tm] (JSP[tm]) relies on packaging the application and associated files into a WebARchive (WAR) file. This seems simple, as the WAR file is the same format as a JavaARchive (JAR) file. However, you also need to create an eXtensisible Markup Language (XML) deployment descriptor (WEB-INF/web.xml) file. There are tools that can do this for you, such as those in the Java[tm] Web Services Developer Pack (free download here), or tools that come with iPlanet[tm] Application Server. However, you may not want to download or buy these products.free download here

Creating a.war file How To WAR file structure - The static HTML files and JSPs are stored in the top level directory. The Servlet and related Java[tm] technology class files must be stored in the WEB-INF/classes directory. Any auxiliary library JAR files must be stored in the WEB-INF/lib directory. The deployment descriptor is stored as a file named web.xml in the WEB- INF directory. Creating the web.xml deployment descriptor - The following is the mandatory header of the web.xml document. This defines the document as an XML file and relates the syntax of the file to the DOCTYPE resource specified.

Recall…about web.xml Servlets The simplest form of deployment descriptor that is needed to deploy a Java[tm] Servlet is as follows (assumes the header is preceding): HelloServlet mypackage.HelloServlet HelloServlet /HelloServlet The element is how the Servlet is known within the XML file, the is the fully qualified Java programming language class name of the Servlet; this Java programming language class needs to be located in the WEB- INF/classes directory. Thus, for the previous example this would be reflected in the directory structure: WEB-INF/classes/mypackage/HelloServlet.class.

Creating a.war file The is how the Servlet is referenced from a Universal Resource Indicator(URI) - see the "Accessing the Content" section of this article. According to the Servlet specification it is recommended that you include a mapping to avoid any potential issues. All of these elements are documented in the Servlet specifications. Note: The structure of the elements must follow the order in the DTD definition. For example all s must be defined before any s can be specified. JSPs JSPs can be deployed in a WAR file in three ways: Without reference in web.xml You can put your JSPs directly in the root of the WAR file; the container will recognise the.jsp extension.

Creating a.war file Precompiling By precompiling the JSP, you have a Servlet. You can reference the JSP's compiled class (Servlet) and also locate the class as in the example from the "Servlets" section of this article. However, the could be something like Foo.jsp, to signify that it is/was a JSP. For more information, see the JSP Specification note in the References section of this article. Referencing You can reference the JSP file in web.xml; by using the example in the "Servlets" section and replacing with. In this case the root is the root of the WAR file, unlike the Servlet scenario.

Creating a.war file Creating the WAR File After you have created your WEB-INF directory, the deployment descriptor, and have put the relevant files in the correct directories, you can use the "jar" utility from the Java[tm] Development Kit distribution to create the WAR file. Check the tools documentation for the full syntax. The command you could use is (assumes you are at the top level of the directory structure in which you assembled the WAR contents): jar cvf mywar.war WEB-INF {related top-level files or directories} You can then deploy mywar.war using, for example, iPlanet[tm] Application Server, iPlanet[tm] Web Server or any J2EE compliant application server or Web container. Accessing the Content The content is generally accessed as follows: or file} The context could be set in the deployment phase or set automatically by the application. For example, deploying to iPlanet WebServer 6.x using wdeploy allows you to specify the context name; but iPlanet Application Server 6.x generally uses the WAR file name as the context.

Making a tea.war file The batch file leaves war in current directory, in this case, my java/bin directory. jar cvf tea.war C:\PROGRA~1\TOMCAT~1.5\WEBAPPS\TEA\ WEB-INF C:\PROGRA~1\TOMCAT~1.5\WEBAPPS\TEA\T eaServlet.jar This was not a good way to do it because it sets the name of the servlet jar file in the war file.

You should be able to: Drop the war file in the webapps directory it needs to go in and restart tomcat That webapp should now be accessible

To unpack If you need to unzip the war file: Unpacking the Application Files A WAR file is basically a Java JAR file, or ZIP file. Copy the app.WAR file from the installation media to the directory you would like to install them to. Create the sub-directory for the web application. Change to the sub-directory. Unzip the files using the command jar -xf../app.WAR

In fact… I never got the webapp working via the.war file I was not able to “unzip” using jar –xf either. These problems may have been due to the path setting I had when I used jar to create the war file. In any case, winzip can unpack a war file and it is working fine now.