ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Java Web Applications
Subject:   error 404- servlet would not load
Date:   2002-11-18 12:37:46
From:   anonymous2
I just want to share this with anyone having this problem.


Despite setting the server.xml netry for the context and, having the correct directory structure, the servlet login wouldn't load and kept giving a 404 error.


I managed to get it right by setting the web.xml file this way :


<?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>
login
</servlet-name>
<servlet-class>
com.onjava.login
</servlet-class>
<load-on-startup>
1
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
login
</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>


I don't know if this makes any sense, but the node <url-pattern> did it and it works now.


1 to 1 of 1
1 to 1 of 1