java.lang.NoSuchMethodError:org.jboss.resteasy.specimpl.BuiltResponse.getHeaders()Ljavax / ws / rs / core / MultivaluedMap

时间:2014-12-22 17:51:05

标签: maven resteasy

我遇到了resteasy的依赖问题。

我正在尝试使用" jetty运行maven项目:run"命令。但是,当我尝试访问Web应用程序的REST组件的端点时,我得到了这个堆栈跟踪。

java.lang.NoSuchMethodError: org.jboss.resteasy.specimpl.BuiltResponse.getHeaders()Ljavax/ws/rs/core/MultivaluedMap;
    at org.jboss.resteasy.core.ServerResponseWriter.setDefaultContentType(ServerResponseWriter.java:195)
    at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:46)
    at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:411)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:376)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
    at org.tynamo.resteasy.ResteasyRequestFilter.service(ResteasyRequestFilter.java:97)
    at $HttpServletRequestFilter_13b242ea59fdcfd6.service(Unknown Source)
    at $HttpServletRequestHandler_13b242ea59fdcfd9.service(Unknown Source)
    at org.lazan.t5.atmosphere.services.internal.HttpServletHttpServletRequestFilter.service(HttpServletHttpServletRequestFilter.java:72)
    at org.lazan.t5.atmosphere.services.internal.AtmosphereHttpServletRequestFilter.service(AtmosphereHttpServletRequestFilter.java:50)
    at $HttpServletRequestHandler_13b242ea59fdcfd9.service(Unknown Source)
    at org.got5.tapestry5.jquery.services.AjaxUploadServletRequestFilter.service(AjaxUploadServletRequestFilter.java:27)
    at $HttpServletRequestHandler_13b242ea59fdcfd9.service(Unknown Source)
    at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
    at $HttpServletRequestFilter_13b242ea59fdcfd2.service(Unknown Source)
    at $HttpServletRequestHandler_13b242ea59fdcfd9.service(Unknown Source)
    at org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
    at $HttpServletRequestHandler_13b242ea59fdcfd9.service(Unknown Source)
    at $HttpServletRequestHandler_13b242ea59fdcfd0.service(Unknown Source)
    at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:387)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)

我发现了这个answer,但是在将依赖关系置于顶部之后,它没有解决我的问题。我也没有在我的pom.xml文件中有这种依赖,所以我想我依赖于使用坏依赖的东西?

编辑2

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>graphene-parent</artifactId>
        <groupId>graphene</groupId>
        <version>4.1.0-SNAPSHOT</version>
    </parent>
    <artifactId>graphene-rest</artifactId>
    <name>${project.artifactId}</name>
    <properties>
        <resteasy.version>3.0.1.Final</resteasy.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>graphene</groupId>
            <artifactId>graphene-model</artifactId>
        </dependency>
        <dependency>
            <groupId>graphene</groupId>
            <artifactId>graphene-dao</artifactId>
        </dependency>
        <dependency>
            <groupId>graphene</groupId>
            <artifactId>graphene-search</artifactId>
        </dependency>
        <dependency>
            <groupId>graphene</groupId>
            <artifactId>graphene-util</artifactId>
        </dependency>

        <!-- Here we are enforcing a specific version of resteasy and it's modules. -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>${resteasy.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
            <version>${resteasy.version}</version>
        </dependency>

        <dependency><!-- Tapestry integration with RESTEasy. -->
            <groupId>org.tynamo</groupId>
            <artifactId>tapestry-resteasy</artifactId>
            <version>0.3.2</version>
            <exclusions><!-- Here we exclude the built in resteasy versions, so we 
                    can specify our own versions. -->
                <exclusion>
                    <groupId>org.jboss.resteasy</groupId>
                    <artifactId>resteasy-jaxrs</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jboss.resteasy</groupId>
                    <artifactId>resteasy-jaxb-provider</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.tynamo</groupId>
            <artifactId>tapestry-model-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- end Testing -->
        <dependency>
            <groupId>vande</groupId>
            <artifactId>vande</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <!-- This changes the WAR file packaging so that what would normally go 
                into WEB-INF/classes is instead packaged as WEB-INF/lib/<appname>.jar. This 
                is necessary for Tapestry to be able to search for page and component classes 
                at startup. Only certain application servers require this configuration, 
                please see the documentation at the Tapestry 5 project page (http://tapestry.apache.org/tapestry5/). -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <archiveClasses>false</archiveClasses>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <description>Baseline rest services</description>
</project>

编辑1

的pom.xml

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
      <groupId>com.humangeo.graphene</groupId>
      <artifactId>humangeo-graphene-movies</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    </parent>
    <artifactId>humangeo-graphene-movies-web</artifactId>
    <packaging>war</packaging>
    <description>Web module (war) for Movies demo</description>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-neo4j</artifactId>
            <version>3.0.0.RELEASE</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-rest</artifactId>
            <version>${base.project.version}</version>
            <type>jar</type>
        </dependency>
        <!-- Here's the war overlay -->
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-web</artifactId>
            <version>${base.project.version}</version>
            <type>war</type>
        </dependency>
        <!-- Here's just the classes, needed for compilation -->
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-web</artifactId>
            <version>${base.project.version}</version>
            <classifier>classes</classifier>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-model</artifactId>
            <version>${base.project.version}</version>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-dao</artifactId>
            <version>${base.project.version}</version>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-search</artifactId>
            <version>${base.project.version}</version>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-util</artifactId>
            <version>${base.project.version}</version>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-memorydb</artifactId>
            <version>${base.project.version}</version>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-dao-sql</artifactId>
            <version>${base.project.version}</version>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-dao-neo4j</artifactId>
            <version>${base.project.version}</version>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-model</artifactId>
            <version>${base.project.version}</version>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-dao</artifactId>
            <version>${base.project.version}</version>
        </dependency>
        <dependency>
            <groupId>${base.project.groupId}</groupId>
            <artifactId>graphene-export</artifactId>
            <version>${base.project.version}</version>
            <type>jar</type>
        </dependency>
    </dependencies>

    <repositories>
        <!-- This repository is only needed when the Tapestry version is a preview 
            release, rather than a final release. -->
        <repository>
            <id>apache-staging</id>
            <url>https://repository.apache.org/content/groups/staging/</url>
        </repository>
    </repositories>

    <build>
        <finalName>humangeo-graphene-movies-web</finalName>
        <resources>
            <resource><!-- This is for picking up any Tapestry .tml templates, .properties 
                    or other resources which are in the src directory. Optionally these could 
                    be in the corresponding resources directory but we don't enforce that on 
                    developers. -->
                <directory>src/main/java</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/*.*</include>
                </includes>
                <excludes>
                    <exclude>**/*.java</exclude>
                    <exclude>**/*.class</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/filtered-resources</directory>
                <targetPath>filtered</targetPath>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <workDirectory>target\overlay-war-folder</workDirectory>
                    <webXml>src\main\webapp\WEB-INF\web.xml</webXml>

                    <overlays>
                        <overlay>
                            <groupId>${base.project.groupId}</groupId>
                            <artifactId>graphene-web</artifactId>
                            <excludes>
                                <exclude>**/log4j.properties</exclude>
                                <exclude>WEB-INF/lib/*.jar</exclude>
                            </excludes>
                        </overlay>
                    </overlays>
                    <!-- If true, this will package the classes as their own jar, INSIDE 
                        the war's web-inf/lib. At the moment this seems incompatible with the attachClasses 
                        flag, which we absolutely need for building. -->
                    <archiveClasses>false</archiveClasses>
                    <attachClasses>true</attachClasses>
                    <!-- Just to be explicit. 'classes' is the default. This makes a second 
                        target as a jar with just the classes and no html/js -->
                    <classesClassifier>classes</classesClassifier>
                </configuration>
            </plugin>
            <!-- Run the application using "mvn jetty:run" -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

0 个答案:

没有答案