• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

trouble loading servlet class on Tomcat4.1.24

 
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,
 
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
 
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
 
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
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic