简体   繁体   English

在Eclipse Oxygen和Tomcat 9中设置RESTful环境

[英]Setting up RESTful environment in Eclipse Oxygen and Tomcat 9

I have been following this tutorial but with the above mentioned specs and Java 9 jdk which came by default with my Macbook. 我一直在遵循教程,但是上面提到的规格和Java 9 jdk随Macbook一起默认提供。 I have manually added Java EE 6 API jar to my class path even to test it is the path I made a Test.java and test by the import javax.ws.rs.Path; 我已经手动将Java EE 6 API jar添加到我的类路径中,甚至测试它是否是我创建的Test.java并通过import javax.ws.rs.Path;进行测试的路径import javax.ws.rs.Path; but I still keep encountering this error when I try to add the jersey jars (JAX-RS) to the project facets. 但是,当我尝试将球衣罐(JAX-RS)添加到项目构面时,仍然会遇到此错误。 Below is the screenshot. 下面是屏幕截图。 The problem is when it says Required class java.ws.rs.Path does not exist in selected libraries . 问题是当它说Required class java.ws.rs.Path does not exist in selected libraries What exactly is going on wrong here? 这到底是怎么了? Thanks in advance. 提前致谢。 This is an attempt to see if not the latest but one of the recent specs can work together in an environment. 尝试查看不是最新的规范还是最新的规范之一可以在环境中一起工作。

在此处输入图片说明

Those tutorial instructions worked for me. 这些教程说明对我有用。 For the error you are getting I think you must have missed this specific step: 对于您遇到的错误,我认为您一定错过了此特定步骤: Rest1

To verify that as the problem, select the list of user libraries using Window -> Preferences -> Java -> Build Path -> User Libraries , then select JAX-RS_Jersey_API and expand that entry. 要验证是否存在此问题,请使用Window- > Preferences-> Java- > Build Path- > User Libraries选择用户库列表 ,然后选择JAX-RS_Jersey_API并展开该条目。 It should look similar to this screen shot but I suspect that the first entry is missing for you: 它看起来应该类似于此屏幕截图,但我怀疑您缺少第一条记录:

Rest2

I used the latest version of Jersey (2.26) which is based on JAX-RS 2.1 rather than JAX-RS 2.0 which the tutorial used, so my file name is slightly different form the one in the tutorial, but that discrepancy does not matter. 我使用的是基于JAX-RS 2.1而不是本教程使用的JAX-RS 2.0的最新版本的Jersey(2.26),因此我的文件名与本教程中的文件名略有不同,但是差异并不重要。 The important thing is that you see an entry for javax.ws.rs-api-*.jar in User Libraries . 重要的是您在User Libraries中看到了javax.ws.rs-api-*。jar的条目。

If you don't see the entry then repeat the step in the tutorial pasted above and everything should be fine. 如果没有看到该条目,请重复上面粘贴的教程中的步骤,一切都应该没问题。 However, if you already have that entry please update your post with a screen shot similar to the User Libraries one shown above. 但是,如果您已经拥有该条目,请使用类似于上面显示的用户库的屏幕快照更新您的帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM