我使用 eclipse WTP 创建了一个 REST WS 应用程序。到目前为止,我使用 Tomcat 7 来部署我的应用程序。我可以将 Tomcat 定义到服务器运行时环境中。现在我想使用 jetty 来部署该应用程序,我下载了 jetty 8 并且我有 eclipse Indigo ..尝试按照我为 Tomcat 所做的方式定义 jetty 但它不起作用,因为可用的适配器适用于 jetty6 并且当我尝试使用此适配器运行我的应用程序时,我收到一条消息,指出服务器不支持 J2EE Web 模块规范 3.0 版
如何从 Eclipse 在 jetty 上运行我的应用程序?
最佳答案
jetty 6仅支持jsp/servlets 2.5规范,因此需要使用支持servlets/jsp 3.0的jetty8
像这样使用maven添加jetty 8
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.revision}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty.revision}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.revision}</version>
</dependency>
其中 jetty 版本例如是这个 8.1.5.v20120716
关于java - 是否可以在eclipse运行时环境中定义jetty服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11691036/