Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't run a servlet

843841Dec 31 2004 — edited Jan 2 2005
You can say that I'm kinda newbie, so here's what the problem is:
Installed Apache Tomcat version 4.0.6 seems to be running well since it loads it's default servlets and JSPs. Then I tried to make a simple servlet and test it, the common Hello World. Currently using NetBeans 3.5.1 it compiles alright but when my browser comes out(Internet Explorer) it shows the following error:

Apache Tomcat/4.0.6 - HTTP Status 503 - Servlet HelloWorld is currently unavailable
--------------------------------------------------------------------------------
type Status report
message Servlet HelloWorld is currently unavailable
description The requested service (Servlet HelloWorld is currently unavailable) is not currently available.

Here's the code of the servlet but I don't think that the problem is there:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorld extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Hello World!</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>Hello World!</h1>");
        out.println("</body>");
        out.println("</html>");
    }
}
If you have any ideas why it is not working please help. Thanks in advance:)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 30 2005
Added on Dec 31 2004
7 comments
744 views