• Post Reply Bookmark Topic Watch Topic
  • New Topic

web.xml tag problem  RSS feed

 
nexus nuitari
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my web.xml it works fine ...



but when I try to make it


This doesnt work why??


using ubuntu 10.04
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.1) (6b18-1.8.1-0ubuntu1)
OpenJDK Server VM (build 16.0-b13, mixed mode)
editor: vi






 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference and how does it not work?
 
nexus nuitari
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
# <servlet>
# <servlet-name>Ch3Beer</servlet-name>
# <servlet-class>com.example.web.BeerSelect</servlet-class>
# </servlet>
#
# <servlet-mapping>
# <servlet-name>Ch3Beer</servlet-name>
# <url-pattern>/SelectBeer.do</url-pattern>
# </servlet-mapping>

when i make it I got 404
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah - it makes more sense now you've edited your post.

An HTTP 404 error means a resource cannot be found. What URL do you access?
 
nexus nuitari
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://localhost:8080/Beer-v1/SelectBeer.do gets 404
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nexus nuitari wrote:http://localhost:8080/Beer-v1/SelectBeer.do gets 404


Change it to http://localhost:8080/SelectBeer.do. I think, it'll work.
 
sreejith sreedharan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check your URL cases are correct .
Once you give the URL mapping , you need to redeploy the application inorder for the apps to work.

 
wangxuehui xuehui
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nexus nuitari wrote:# <servlet>
# <servlet-name>Ch3Beer</servlet-name>
# <servlet-class>com.example.web.BeerSelect</servlet-class>
# </servlet>
#
# <servlet-mapping>
# <servlet-name>Ch3Beer</servlet-name>
# <url-pattern>/SelectBeer.do</url-pattern>
# </servlet-mapping>

when i make it I got 404

I think you can change the url-pattern to /SelectBeer
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan wrote:
nexus nuitari wrote:http://localhost:8080/Beer-v1/SelectBeer.do gets 404


Change it to http://localhost:8080/SelectBeer.do. I think, it'll work.


No - all web application URLs are relative to the context they are deployed in. This will only work if the application is deployed as the root application (to use Tomcat's term).
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wangxuehui xuehui wrote:
nexus nuitari wrote:# <servlet>
# <servlet-name>Ch3Beer</servlet-name>
# <servlet-class>com.example.web.BeerSelect</servlet-class>
# </servlet>
#
# <servlet-mapping>
# <servlet-name>Ch3Beer</servlet-name>
# <url-pattern>/SelectBeer.do</url-pattern>
# </servlet-mapping>

when i make it I got 404

I think you can change the url-pattern to /SelectBeer

Nope. There is no wild card in the url pattern so /SelectBeer will not match a request for /SelectBeer.do.
 
nexus nuitari
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem still remaining.. any ideas
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nexus nuitari wrote:http://localhost:8080/Beer-v1/SelectBeer.do gets 404


So you need a web application deployed with the with the context "Beer-v1". This is case sensitive. If you deploy a static file at the root of this web application can you access this no problem? (e.g. http://localhost:8080/Beer-v1/test.html)

In your web.xml you need a mapping for /SelectBeer.do. Again this is case sensitive - is it there?

Is anything else mapped in your web.xml?
 
nexus nuitari
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Paul Sturrock I don't know how but it works fine now I didn't change anything but its working now
 
Soniya Ahuja
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nexus,
I think you must have not restarted the server after you made changes in web.xml. Next time you make changes to web.xml, try restarting the server and check
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!