Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trouble loading servlet class on Tomcat4.1.24

 
newworld kingdom
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Serge Kurenkov
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
\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
 
Elinor Chang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic