HTTP Status 500 - No Context configured to process this request

kmthien

Senior member
Oct 8, 2002
363
0
0
Hi guys,

I have installed Tomcat and Apache in Win2K. I have compile a Time.java

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Date;

public class Time extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse rsp)
throws ServletException, IOException {
rsp.setContentType("text/html");
PrintWriter out = rsp.getWriter();

Date now = new Date(); // The current date/time

out.println("<html>");
out.println("<head><title> Time Check </title></head>");
out.println("<body>");
out.println("<p>The time is: " + now + "</p>");
out.println("</body></html>");
}
}

to Time.class and copied it to webapps\ROOT\WEB-INF\classes
The webapps\ROOT\WEB-INF\web.xml file is as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<servlet>
<servlet-name>
time
</servlet-name>
<servlet-class>
Time
</servlet-class>
</servlet>
</web-app>

When I entered http://localhost:8080/servlet/time in IE 6.0, it showed
HTTP Status 500 - No Context configured to process this request

Pls help, Thanks !

kmthien


 

Aso

Senior member
Aug 16, 2000
381
0
76
Move your time.class file from the classes directory to the servlet directory. Then restart tomcat.
Tomcat looks for servlets in the servlet directory.
 

kmthien

Senior member
Oct 8, 2002
363
0
0
Where is the servlet directory ?

I tried to create a servlet folder under

\webapps\ROOT\WEB_INF\servlet\

and put the Time.class in this servlet folder but still can't work ! How ?
 

GhettoFob

Diamond Member
Apr 27, 2001
6,800
0
76
I have no idea how to help but I like the fact that you change your icon on every post.

^pity bump