After coding and deploying my first servlet application on Tomcat 5.0, I entered following URL in browser to test the servlet.
http://machineName:portNumber/webapplication/servlet/servletName
This did not work and I got "HTTP 404" error.
I tried to run same servlet application on Resin and it worked.
After googling a little, I came to know that the file
"installationDirectory"\Apache Software Foundation\Tomcat 5.0\conf\web.xml
is responsible for the mapping "/servlet/servletName" to our servlet.
In newer Tomcat versions, this mapping is disabled for some reason I don’t know.
To enable this /servlet/* mapping, you have to uncomment two things:
- servlet "invoker" in <servlet> and
- servlet mapping for /servlet/* which is mapped to "invoker" servlet in <servlet-mapping>
After uncommenting these two things, restart the server and things should go fine.
Do let me know if this doesn’t work.
If anybody have any idea about why /servlet/* mapping is disabled in Tomcat's latest versions, drop me your comment.
Subscribe to:
Post Comments (Atom)
4 comments:
lage raho
hi, i have html files calling servlets through javascript
document.f1.action="./reg1";document.f1.submit();
and my web.sml file :
reg1
reg1
reg1
/reg1
but it is not running, the only thing i see is a white screen.
Please Help.
please help. thanks
Good Servlet Mapping Tutorial
Post a Comment