my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes trouble loading servlet class on Tomcat4.1.24 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "trouble loading servlet class on Tomcat4.1.24 " Watch "trouble loading servlet class on Tomcat4.1.24 " New topic
Author

trouble loading servlet class on Tomcat4.1.24

newworld kingdom
Greenhorn

Joined: Jun 21, 2003
Posts: 10
Hi,
I installed Tomcat4.1.24. I could load jsp files in
TOMCAT_HOME/webapps/ROOT directory into browser like this:
http://localhost:8080/sample.jsp
but I could not load servlets classes from
TOMCAT_HOME/webapps/ROOT/WWEB-INF/classes into
the brwowser:
http://localhost:8080/servlet/myservlet
I found the "invoker" in the TOMCAT-HOME/conf/web.xml file , Turn it on ,just like this
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
But I still can't load servlet class after restart the server.
Anybody can help me? thanks!

Thanks,
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Try moving your servlet to /webapps/examples/WEB-INF/classes. The context path is already set for examples, so this should run your servlet:
http://localhost:8080/examples/servlet/myservlet


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Serge Kurenkov
Greenhorn

Joined: Jul 15, 2003
Posts: 13
\WEB-INF\web.xml :
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>mypackage.MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/myServlet</url-pattern>
</servlet-mapping>
browser url
http://localhost:8080/myservlet


Best regards.<br />------------------------<br />SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCEA 5, SCDJWS 5
Elinor Chang
Ranch Hand

Joined: Jul 30, 2003
Posts: 58
Just one more thing to Sergey Kurenkov's solution. I guess, you probably need to prefix the 'example' in your URL to invoke your servlet. It should look like the following
http://localhost:8080/examples/myservlet


The more I learn, the less I know....<br /> <br />SCJP2 <br />SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trouble loading servlet class on Tomcat4.1.24