users@glassfish.java.net

Glassfish requested resource () is not available servlet issue

From: <glassfish_at_javadesktop.org>
Date: Tue, 12 Jan 2010 12:29:11 PST

I'm a beginner trying to get a very simple servlet working.<P>

The servlet is HelloWorldServlet (code below).
I have placed the class in the HelloWorldServlet/WEB_INF/classes folder.
I configure the web.xml as indicated below.<P>

I can deploy the application successfully with the command:
asadmin deploy HelloWorldServlet<P>

I can then see the application under Applications in the Glassfish web admin interface. I then click on Launch to start the app and I get the following:<P>

HTTP Status 404 -<BR>
type Status report<BR>
message<BR>
descriptionThe requested resource () is not available.<P>
 
Any ideas on how to fix this are appreciated. Thanks.<P>
<P>

HelloWorldServlet compiled in HelloWorldServlet/WEB_INF/classes:<P>
--------------------------------------------------------------------------------------------------<P>
import java.sql.*;<BR>
import java.io.*;<BR>
import java.util.*;<BR>
import javax.servlet.*;<BR>
import javax.servlet.http.*;<BR>
<BR>
public class HelloWorldServlet extends HttpServlet<BR>
{<BR>
  public void doGet(HttpServletRequest inRequest, HttpServletResponse outResponse)<BR>
                    throws ServletException, IOException<BR>
  {<BR>
    PrintWriter out = null;<BR>
<BR>
      outResponse.setContentType("test/html");<BR>
      out = outResponse.getWriter();<BR>
<BR>
      out.println("Hello World");<BR>
  }<BR>
<BR>
  public void doPost(HttpServletRequest inRequest, HttpServletResponse outResponse)<BR>
                     throws ServletException, IOException<BR>
  {<BR>
    doGet(inRequest, outResponse);<BR>
  }<BR>
}<BR>
--------------------------------------------------------------------------------<BR>
<BR>
web.xml in HelloWorldServlet/WEB_INF:<BR>
---------------------------------------------------------------------------------<BR>
<?xml version="1.0" encoding="UTF-8"?><BR>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"><BR>
<BR>
<web-app><BR>
  <display-name>HelloWorldServlet</display-name><BR>
  <description>Hello world test servlet</description><BR>
<BR>
   <servlet><BR>
      <servlet-name>HelloWorldServlet</servlet-name><BR>
      <servlet-class>HelloWorldServlet</servlet-class><BR>
   </servlet><BR>
<BR>
   <servlet-mapping><BR>
      <servlet-name>HelloWorldServlet</servlet-name><BR>
      <url-pattern>/hey</url-pattern><BR>
   </servlet-mapping><BR>
<BR>
</web-app><BR>
[Message sent by forum member 'pimathieu' (mathieu_at_nrcan.gc.ca)]

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