404 when accessing Jersey app in Tomcat 7

后端 未结 2 1483
我寻月下人不归
我寻月下人不归 2021-01-25 04:01

I am a newby in web development and I am struggling to create a simple rest web service using jersey, packed as an independent war file, to be deployed on tomcat 7.

I ha

2条回答
  •  独厮守ぢ
    2021-01-25 04:14

    if you have called your project in eclipse: rest, so you should get the correct message: "Hello world!" from tomcat with the url:

    http://localhost:8080/rest/hello.
    

    If you for example have called your project: MyHello, with the code you posted the correct url should be:

    http://localhost:8080/MyHello/hello
    

    (The reason is that Eclipse create by default a war called as the name of the project and publish it to the tomcat server you have added in your configuration)

    Let me know

提交回复
热议问题