users@glassfish.java.net

Re: Web Deploying Error

From: Ludovic Champenois <Ludovic.Champenois_at_Sun.COM>
Date: Sat, 06 Dec 2008 08:46:58 -0800

glassfish_at_javadesktop.org wrote:
> Show error on server.log
>
> [#|2008-12-06T12:47:20.750+0530|WARNING|sun-glassfish|javax.enterprise.system.tools.deployment|_ThreadID=18;_ThreadName=Thread-3;|[AutoDeploy] Autodeploy failed : D:\glassfishv3-prelude\glassfish\domains\domain1\autodeploy\simpleapp.war.|#]
>
> servlet
> ---------
>
> package net.ensode.glassfishbook.simpleapp;
> import java.io.IOException;
> import java.io.PrintWriter;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> public class SimpleServlet extends HttpServlet{
> protected void doGet(HttpServletRequest request, HttpServletResponse response) {
> try {
> response.setContentType("text/html");
> PrintWriter printWriter = response.getWriter();
> printWriter.println("<h2>");
> printWriter .println("If you are reading this,your application server is good to go!");
> printWriter.println("</h2>");
> } catch (IOException ioException) {
> ioException.printStackTrace();
> }
> }
> }
>
>
>
> web.xml
> ------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"
> xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation=" http://java.sun.com/xml/ns/ javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
> <servlet>
> <servlet-name>SimpleServlet</servlet-name>
> <servlet-class>
> net.ensode.glassfishbook.simpleapp.SimpleServlet
> </servlet-class>
> </servlet>
> <servlet-mapping>
> <servlet-name>SimpleServlet</servlet-name>
> <url-pattern>/simpleservlet</url-pattern>
> </servlet-mapping>
> </web-app>
>
>
> --------------------
>
> servlet compilation
> ----------------------------
> javac -cp /opt/glassfish/lib/javaee.jar:. net/ensode/glassfishbook/simpleapp/SimpleServlet.java
>
> command for creation of war file
> ----------------------------------------------
> jar cvf simpleapp.war
>

This is the issue: a war file is more complex than a jar file. You also
need to package the WEB-INF/ directory that contains the web.xml and the
classee/ directory that contain your classes...
You'd better read documentation:
https://glassfish.dev.java.net/downloads/quickstart/index.html#Packaging_and_Deploying_Applications
or even better, use an IDE that would guide you on how to construct the
correct content for the WAR file.

Or unzip a war file yo understand the structure.
Ludo
> [Message sent by forum member 'thahir' (thahir)]
>
> http://forums.java.net/jive/thread.jspa?messageID=320426
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>