且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Java,Eclipse的RESTful Web服务创建教程。 Apache Tomcat,不工作

更新时间:2023-08-31 15:03:34

To solve your problem, without using Maven, you need to add JAX-RS facet to your project. What's happening here is that Eclipse is not deploying the right libs to the server. This configuration can be accessed through your project's Properties | Project's Facets.

To be honest I don't know which specific jars to add to make Jersey work, because I use Maven to manage dependencies. So instead of the zip file, I've downloaded the Jersey bundle, and configured the JAX-RS facet with it. The effect of this can be seen on the project's Properties | Deployment Assembly, where Jersey's libs are already configured to be deployed. By the way is there you can manually setup the deployed libs to the server.

But then I remembered why I use Maven to manage dependencies. The bundle does not contain everything it needs to run Jersey. It's missing the asm jar (present in the zip file). So I had to add it to projects build path, and reconfigure de deployment assembly manually....

So, here is a tutorial with Maven, Jersey and Eclipse. Try it and draw your conclusions :)