users@glassfish.java.net

Web Deploying Error

From: <glassfish_at_javadesktop.org>
Date: Sat, 06 Dec 2008 01:17:55 PST

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
[Message sent by forum member 'thahir' (thahir)]

http://forums.java.net/jive/thread.jspa?messageID=320426