Gradle问题-试图用Jetty和Resteasy做一些JAX-RS2-ClassNotFoundException:



我使用:

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

更新:如果我直接在Jetty中部署我的war,它会很好,但如果我从gradlejettyRun任务开始,它会失败。所以它与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>

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

感谢

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

相关内容

  • 没有找到相关文章

最新更新