Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in running servlet  RSS feed

 
pankaj goswami
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my web.xml:-

<web-app>
<servlet>
<servlet-name>alias1</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>alias1</servlet-name>
<url-pattern>/alias</url-pattern>
</servlet-mapping>

when i try to access by http://localhost:8080/alias1/alias

i am getting error 404.

please tell me where i am wrong in my xml entries and please descible me these tag in this xml. i am in doubt . please

thanks for your support.
 
Wayan Saryada
Ranch Hand
Posts: 105
IntelliJ IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where does the application context path located? did you deploy your application in the "/alias1" context path?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


All classes used in servlets should be in a package to avoid problems like this. For classes in the "default" package, the JVM looks in the "current" directory - something you have no control over. You may see this default package usage in earlier books because Tomcat used to come with the "invoker" servlet magic turned on. See this FAQ entry for why this is a bad idea.

Bill
 
bakiyalakshmi dhanraj
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
In web.xml the servlet name and servlet class should be same.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by bakiyalakshmi dhanraj:
In web.xml the servlet name and servlet class should be same.

Not correct. There is no need for the servlet name and class to match,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!