3

我用:

  • 码头 8.1.11
  • Resteasy 3.0.1.Final
  • Gradle 1.6 - jettyRun 任务 - 在 Windows 7 上运行 -> 这是罪魁祸首

更新:如果我直接在 Jetty 中部署我的战争,它工作正常,但如果我从 gradle jettyRun 任务开始,它会失败。所以它与Gradle有关

我得到这个堆栈:

java.lang.NoClassDefFoundError: javax/servlet/AsyncListener
    at org.jboss.resteasy.plugins.server.servlet.Servlet3AsyncHttpRequest.<init>(Servlet3AsyncHttpRequest.java:38)
    at org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher.createHttpRequest(HttpServlet30Dispatcher.java:24)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.createResteasyHttpRequest(HttpServletDispatcher.java:61)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:210)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)

我的毕业生:

apply plugin: 'war'

apply plugin: 'jetty'

apply plugin: 'idea'


sourceCompatibility = 1.7
targetCompatibility = 1.7

def springVersion = "3.2.3.RELEASE"
def jaxrsVersion = "2.0"
def resteasyVersion = "3.0.1.Final"

group = 'com.test'
version = '1.0-SNAPSHOT'

...

dependencies {

    compile "org.jboss.resteasy:resteasy-jaxrs:$resteasyVersion"
    compile "org.jboss.resteasy:async-http-servlet-3.0:$resteasyVersion"
}

Web.xml:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">

    <display-name>Archetype RestEasy Web Application</display-name>
       <context-param>
           <param-name>resteasy.servlet.mapping.prefix</param-name>
           <param-value>/chat</param-value>
       </context-param>

       <servlet>
           <servlet-name>Resteasy</servlet-name>
           <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher</servlet-class>
           <init-param>
               <param-name>javax.ws.rs.Application</param-name>
               <param-value>com.test.MovieManApiApplication</param-value>
           </init-param>
       </servlet>

       <servlet-mapping>
           <servlet-name>Resteasy</servlet-name>
           <url-pattern>/chat/*</url-pattern>
       </servlet-mapping>

</web-app>

我看不到缺少什么,也没有在网上找到任何真正相关的东西。

谢谢

4

1 回答 1

3

Gradle 的 Jetty 插件基于 Jetty 6,不支持 Servlet 3.0。您可能想查看Arquillian Gradle 插件Gradle Cargo 插件

于 2013-06-27T05:19:28.450 回答