Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Please help me about Servlet  RSS feed

 
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
 
MI Mohammed
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pengpeng,

I actually don't know why you are unable to access
your servlet. But what i can tell you for now, is tha for
Tomcat, you don't need to tourch the server.xml file.
Try the following steps, you should be able to run your app.

1. Since you altered the server.xml, return it to the default
setting, just comment out what you added.
2. Create your app directory inside the webapp dir.
Simple put the web.xml inside the WEB-INF dir.
Restart tomcat, you should be able to run the app.

cheers


SCJP SCJA SCWCD SCBCD pro....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!