Subject: not able to find classfile mapping through web.xml
Posted By: winnith Post Date: 12/26/2003 11:56:39 AM
Hi,
   I have written a servlet program named ContextServlet that will dislay on the output

out.println("<html>");
out.println("<head><title>Context Servlet</title></head>");
out.println("<body>");
out.println("</body></html>");

This servlet class file is in

....webapps\ch02app\web-inf\classes\chapter2 directory.

The web.xml file for this is

<?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>
<servlet>
<servlet-name>ContextServlet</servlet-name>
<servlet-class>chapter2.ContextServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ContextServlet</servlet-name>
<url-pattern>context</url-pattern>
</servlet-mapping>
</web-app>

This web.xml is in web-inf folder. I am trying to execute this servlet by giving the following URL in Netscape7/IE browser
        http://localhost:8080/ch02app/context

But I am getting the following error message
   HTTP Status 404 - /context
   The requested resource (/context) is not available.

I am using tomcat4 and jdk1.3 on Windows 98.

Is there any CLASSPATH setting required. If so where and what do I set it. Is the web.xml correct. How do I know whether it is getting parsed and if not, is a special parser required?? Each time I have changed web.xml I have bounced the tomcat server. I have added a CLASSPATH for my servlet in autoexec.bat and have restarted my machine.  I dont know what else to do. Please advice. Mail to winnithr@yahoo.com

Best Regards,
Winnith
Reply By: LuywNjupt Reply Date: 1/2/2004 1:07:35 AM
I have the same trouble.But I think you could try by changing the fold name "web-inf" to "WEB-INF".


Go to topic 7063

Return to index page 976
Return to index page 975
Return to index page 974
Return to index page 973
Return to index page 972
Return to index page 971
Return to index page 970
Return to index page 969
Return to index page 968
Return to index page 967