Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

web.xml tag problem

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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






 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://localhost:8080/Beer-v1/SelectBeer.do gets 404
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
problem still remaining.. any ideas
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
This tiny ad is suggesting that maybe she should go play in traffic.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic