| Author |
404 error on calling my servlet
|
Ray Smilgius
Ranch Hand
Joined: Jan 29, 2001
Posts: 120
|
|
wheni try to run my own servlets on newly installed Tomcat , for eg with following settings: In folder %Tomcat_Home%\webapps\FortKnox folloing files are there : - index.jsp - WEB-INF\classes\pleasework.class - WEB-INF\web.xml C:\jarkarta-tomcat-4.0\webapps\FortKnox\WEB_INF\classes //my servlet is here called 'pleasework.class' //web.xml file below <web-app><servlet><servlet-name>serve</servlet-name><servlet-class>pleasework</servlet-class></servlet></web-app> my port has been changed to 80 instead of 8080 Now when i request : <http://localhost/FortKnox> tomcat responds with 'index.jsp' correctly But when i request : <http://localhost/FortKnox/servlet/serve> Browser 404 file not found: //also I tried this as well. <http://localhost/FortKnox/serve> Browser 404 file not found: ------------------ Sun Certified Java Programmer Sun Certified Java Developer I-Net Certified A+ Certified Network+ Certified MCP [This message has been edited by Ray Smilgius (edited November 19, 2001).] [This message has been edited by Ray Smilgius (edited November 19, 2001).]
|
SCJO, SCJD, SCWCD, I-Net+, A+, Network+, MCSD, MCDBA, MCP, MCT
|
 |
Mike Curwen
Ranch Hand
Joined: Feb 20, 2001
Posts: 3695
|
|
Do you have a servlet mapping? You need two pieces, because it uses that 'ole double indirection. <servlet> <servlet-name>serve</servlet-name> <display-name>optional</display-name> <servlet-class>pleasework</servlet-class> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>serve</servlet-name> <url-pattern>servePattern</url-pattern> </servlet-mapping> That should make http://localhost/FortKnox/servePattern serve up the 'serve' servlet, which is the 'pleasework' class file.
|
 |
Ray Smilgius
Ranch Hand
Joined: Jan 29, 2001
Posts: 120
|
|
I am at home now when I get back to work I will try this. Thanks very much
|
 |
Ray Smilgius
Ranch Hand
Joined: Jan 29, 2001
Posts: 120
|
|
What is servlet mapping?? Thanks
|
 |
Mike Curwen
Ranch Hand
Joined: Feb 20, 2001
Posts: 3695
|
|
A servlet mapping 'maps' an URL pattern to a particular servlet. Suggested reading: http://www.jcp.org/aboutJava/communityprocess/final/jsr053/ The servlet spec, which explains some of this... http://java.sun.com/j2ee/dtds/web-app_2_2.dtd The DTD for web.xml (don't bother with ie, use Netscape to view this one) [This message has been edited by Mike Curwen (edited November 20, 2001).]
|
 |
Ray Smilgius
Ranch Hand
Joined: Jan 29, 2001
Posts: 120
|
|
Thanks sir. Ray
|
 |
 |
|
|
subject: 404 error on calling my servlet
|
|
|