Java Restful Service eclipse tomcat HTTP Error 404

后端 未结 2 2026
难免孤独
难免孤独 2021-01-21 01:22

i try to keep up with a java rest service. So i found some tutorials, which explain always the same way. But i cant get this running :(.

I made Dynamic Web Project in Ve

相关标签:
2条回答
  • 2021-01-21 01:56

    You're using the old (1.x) Jersey configuration. In Jersey 2.x, the class namescpaces and property names have changed. You should instead use

    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>jersey.config.server.provider.packages</param-name>
        ...
    

    See other deployment options here

    0 讨论(0)
  • 2021-01-21 02:07

    localhost:8080/com.freespots.rest this URL will run welcome page which is index.html as you said, and localhost:8080/com.freespots.rest/api/hello here no page found so 404 not found error. Try to put @Path("name") above method and call localhost:8080/com.freespots.rest/api/hello/name

    0 讨论(0)
提交回复
热议问题