Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Access error

 
pengpeng lin
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,everybody.I want to ask a question about Servlet access.

I added a web app to the "webapps" directory and restart the Tomcat. When I type the URL:http://localhost:8080/helloapp/showpathtest it give me a 404 error.

Here is the configuration of server.xml and web.xml
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="/helloapp" docBase="helloapp" debug="0" reloadable="true"/>
<Host>

<servlet>
<servlet-name>showpathtest</servlet-name>
<servlet-class>mypack.ShowPathTest</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>showpathtest</servlet-name>
<url-pattern>/showpathtest</url-pattern>
</servlet-mapping>

and the ShowPathTest.class is under the WEB-INF/classes/mypack directory.


Can anybody help me! Thanks a lot
 
pengpeng lin
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody help me? I'm new to Tomcat.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you put the servlet and servlet-mapping entries?
Hopefully in your web.xml file.
Where did you put your web.xml file?

You didn't need to edit server.xml.
Tomcat will automatically deploy apps that it finds in the webapps directory.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic