java - Jackson NoSuchMethodError requiresPropertyOrdering maven with google app engine project at runtime -
i'm trying app engine maven project running , appear have found myself in jar hell. project has built , run in past without using maven, i've had enough of eclipse's nonsense , trying mavenize project usual reasons.
currently working compiling , tests passing (with mvn clean install
myproject-war
directory shown here). i'm able launch mvn appengine:devserver
myproject-ear
directory , server running. navigating 1 of servlets, however, nosuchmethoderror
trace shown below. (all code @ bottom readability).
this looks similar other posts jackson versions weren't in sync. however, jackson versions seem ok, can seen in pom.xml
, @ bottom. appears that method didn't appear until jackson 3.0, again seems ok because of output of mvn dependency:tree -dverbose | ack jackson
, fact i'm depending on 2.4.1
.
the culprit can think of google library, i'm using because i'm following example here appears rely on it. however, i'm not sure how go testing hypothesis or getting google library work without dependency. perhaps <exlcudes>
tag, i'm not sure how apply it.
does have suggestions or things i'm missing? how can correct version of class used @ runtime? or missing , solution entirely different?
edit: note on advice of comment/answer have ensured of libraries responsible use same version of fasterxml/jackson rather older codehaus packaing. agree appears there still older dependency somewhere causing problems, precisely problem struggling correct.
edit 2: got working cleaned overall project , dependency structure, although can't provide exacty fix why. think issue due dependency:
<dependency> <groupid>com.fasterxml.jackson.jaxrs</groupid> <artifactid>jackson-jaxrs-json-provider</artifactid> <version>2.4.1</version> </dependency>
it has dependency on org.jboss.resteasy:resteasy-jackson2-provider:3.0.6.final
, depends on com.fasterxml.jackson.core:jackson-databind:2.2.1
, doesn't have missing method, pointed out in original post.
mvn dependency:tree -dverbose | ack jackson
:
[info] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.4.1:compile [info] | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.4.1:compile [info] | | +- (com.fasterxml.jackson.core:jackson-core:jar:2.4.1:compile - omitted duplicate) [info] | | \- (com.fasterxml.jackson.core:jackson-databind:jar:2.4.1:compile - omitted duplicate) [info] | +- (com.fasterxml.jackson.core:jackson-core:jar:2.4.1:compile - omitted duplicate) [info] | +- (com.fasterxml.jackson.core:jackson-databind:jar:2.4.1:compile - omitted duplicate) [info] | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.4.1:compile [info] | +- (com.fasterxml.jackson.core:jackson-core:jar:2.4.1:compile - omitted duplicate) [info] | \- (com.fasterxml.jackson.core:jackson-databind:jar:2.4.1:compile - omitted duplicate) [info] +- com.fasterxml.jackson.core:jackson-core:jar:2.4.1:compile [info] +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.1:compile [info] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.0:compile [info] | \- (com.fasterxml.jackson.core:jackson-core:jar:2.4.1:compile - omitted duplicate) [info] | +- com.google.http-client:google-http-client-jackson2:jar:1.19.0:compile [info] | | \- (com.fasterxml.jackson.core:jackson-core:jar:2.1.3:compile - omitted conflict 2.4.1) [info] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:test [info] | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:test
exception trace:
java.lang.nosuchmethoderror: com.fasterxml.jackson.core.jsonfactory.requirespropertyordering()z @ com.fasterxml.jackson.databind.objectmapper.<init>(objectmapper.java:458) @ com.fasterxml.jackson.databind.objectmapper.<init>(objectmapper.java:379) @ com.fasterxml.jackson.jaxrs.json.jsonmapperconfigurator.getdefaultmapper(jsonmapperconfigurator.java:44) @ com.fasterxml.jackson.jaxrs.base.providerbase.locatemapper(providerbase.java:856) @ com.fasterxml.jackson.jaxrs.base.providerbase.writeto(providerbase.java:588) @ org.jboss.resteasy.core.interception.abstractwriterinterceptorcontext.writeto(abstractwriterinterceptorcontext.java:129) @ org.jboss.resteasy.core.interception.serverwriterinterceptorcontext.writeto(serverwriterinterceptorcontext.java:62) @ org.jboss.resteasy.core.interception.abstractwriterinterceptorcontext.proceed(abstractwriterinterceptorcontext.java:118) @ org.jboss.resteasy.plugins.interceptors.encoding.gzipencodinginterceptor.aroundwriteto(gzipencodinginterceptor.java:100) @ org.jboss.resteasy.core.interception.abstractwriterinterceptorcontext.proceed(abstractwriterinterceptorcontext.java:122) @ org.jboss.resteasy.core.serverresponsewriter.writenomapresponse(serverresponsewriter.java:99) @ org.jboss.resteasy.core.synchronousdispatcher.writeresponse(synchronousdispatcher.java:427) @ org.jboss.resteasy.core.synchronousdispatcher.invoke(synchronousdispatcher.java:376) @ org.jboss.resteasy.core.synchronousdispatcher.invoke(synchronousdispatcher.java:179) @ org.jboss.resteasy.plugins.server.servlet.servletcontainerdispatcher.service(servletcontainerdispatcher.java:220) @ org.jboss.resteasy.plugins.server.servlet.httpservletdispatcher.service(httpservletdispatcher.java:56) @ org.jboss.resteasy.plugins.server.servlet.httpservletdispatcher.service(httpservletdispatcher.java:51) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.mortbay.jetty.servlet.servletholder.handle(servletholder.java:511) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1166) @ com.google.appengine.api.socket.dev.devsocketfilter.dofilter(devsocketfilter.java:74) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.responserewriterfilter.dofilter(responserewriterfilter.java:127) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.headerverificationfilter.dofilter(headerverificationfilter.java:34) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.api.blobstore.dev.serveblobfilter.dofilter(serveblobfilter.java:63) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.apphosting.utils.servlet.transactioncleanupfilter.dofilter(transactioncleanupfilter.java:43) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.staticfilefilter.dofilter(staticfilefilter.java:125) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.devappservermodulesfilter.dodirectrequest(devappservermodulesfilter.java:366) @ com.google.appengine.tools.development.devappservermodulesfilter.dodirectmodulerequest(devappservermodulesfilter.java:349) @ com.google.appengine.tools.development.devappservermodulesfilter.dofilter(devappservermodulesfilter.java:116) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ org.mortbay.jetty.servlet.servlethandler.handle(servlethandler.java:388) @ org.mortbay.jetty.security.securityhandler.handle(securityhandler.java:216) @ org.mortbay.jetty.servlet.sessionhandler.handle(sessionhandler.java:182) @ org.mortbay.jetty.handler.contexthandler.handle(contexthandler.java:765) @ org.mortbay.jetty.webapp.webappcontext.handle(webappcontext.java:418) @ com.google.appengine.tools.development.devappenginewebappcontext.handle(devappenginewebappcontext.java:98) @ org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java:152) @ com.google.appengine.tools.development.jettycontainerservice$apiproxyhandler.handle(jettycontainerservice.java:491) @ org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java:152) @ org.mortbay.jetty.server.handle(server.java:326) @ org.mortbay.jetty.httpconnection.handlerequest(httpconnection.java:542) @ org.mortbay.jetty.httpconnection$requesthandler.headercomplete(httpconnection.java:923) @ org.mortbay.jetty.httpparser.parsenext(httpparser.java:547) @ org.mortbay.jetty.httpparser.parseavailable(httpparser.java:212) @ org.mortbay.jetty.httpconnection.handle(httpconnection.java:404) @ org.mortbay.io.nio.selectchannelendpoint.run(selectchannelendpoint.java:409) @ org.mortbay.thread.queuedthreadpool$poolthread.run(queuedthreadpool.java:582)
my pom.xml
:
<?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> <packaging>war</packaging> <version>1.0-snapshot</version> <groupid>org.mygroupid</groupid> <artifactid>myproject-server-war</artifactid> <parent> <groupid>org.mygroupid</groupid> <artifactid>myproject-server</artifactid> <version>1.0-snapshot</version> </parent> <properties> <appengine.app.version>1-war</appengine.app.version> <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> <dependencies> <!-- compile/runtime dependencies --> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-api-1.0-sdk</artifactid> <version>${appengine.target.version}</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupid>jstl</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.31</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.jaxrs</groupid> <artifactid>jackson-jaxrs-json-provider</artifactid> <version>2.4.1</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-core</artifactid> <version>2.4.1</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-databind</artifactid> <version>2.4.1</version> </dependency> <dependency> <groupid>joda-time</groupid> <artifactid>joda-time</artifactid> <version>2.3</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>4.2.8.final</version> </dependency> <dependency> <groupid>org.hibernate.common</groupid> <artifactid>hibernate-commons-annotations</artifactid> <version>4.0.4.final</version> </dependency> <dependency> <groupid>org.jboss.resteasy</groupid> <artifactid>resteasy-jaxrs</artifactid> <version>3.0.8.final</version> </dependency> <dependency> <groupid>com.google.api-client</groupid> <artifactid>google-api-client</artifactid> <version>1.19.0</version> </dependency> <dependency> <groupid>com.google.api-client</groupid> <artifactid>google-api-client-gson</artifactid> <version>1.19.0</version> </dependency> <!-- our custom common jar. --> <dependency> <groupid>groupid</groupid> <artifactid>myproject-common</artifactid> <version>0.1-snapshot</version> </dependency> <!-- test dependencies --> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-testing</artifactid> <version>${appengine.target.version}</version> <scope>test</scope> </dependency> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-api-stubs</artifactid> <version>${appengine.target.version}</version> <scope>test</scope> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.10</version> <scope>test</scope> </dependency> <dependency> <groupid>org.mockito</groupid> <artifactid>mockito-all</artifactid> <version>1.9.0</version> <scope>test</scope> </dependency> <dependency> <groupid>groupdid</groupid> <artifactid>myproject-common</artifactid> <version>0.1-snapshot</version> <scope>test</scope> </dependency> <dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-mapper-asl</artifactid> <version>1.9.13</version> <scope>test</scope> </dependency> <dependency> <groupid>org.easytesting</groupid> <artifactid>fest-assert-core</artifactid> <version>2.0m10</version> <scope>test</scope> </dependency> </dependencies> <build> <outputdirectory>target/${project.artifactid}-${project.version}/web-inf/classes</outputdirectory> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-war-plugin</artifactid> <version>2.3</version> <configuration> <archiveclasses>true</archiveclasses> <webresources> <!-- in order interpolate version pom appengine-web.xml --> <resource> <directory>${basedir}/src/main/webapp/web-inf</directory> <filtering>true</filtering> <targetpath>web-inf</targetpath> </resource> </webresources> </configuration> </plugin> </plugins> </build>
this working me gae 1.9.7
properties
<properties> <appengine.target.version>1.9.7</appengine.target.version> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <resteasy.version>3.0.8.final</resteasy.version> <jackson.version>2.4.1</jackson.version> <slf4j.version>1.7.7</slf4j.version> <reflections.version>0.9.9-rc2</reflections.version> </properties>
dependency management
<dependencymanagement> <dependencies> <!-- third party dependencies --> <dependency> <groupid>com.google.code.findbugs</groupid> <artifactid>findbugs</artifactid> <version>3.0.0</version> </dependency> <dependency> <groupid>org.reflections</groupid> <artifactid>reflections</artifactid> <version>${reflections.version}</version> </dependency> <dependency> <groupid>com.google.guava</groupid> <artifactid>guava</artifactid> <version>17.0</version> </dependency> <dependency> <groupid>com.google.inject</groupid> <artifactid>guice</artifactid> <version>3.0</version> </dependency> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-api-1.0-sdk</artifactid> <version>${appengine.target.version}</version> </dependency> <dependency> <groupid>com.google.appengine.tools</groupid> <artifactid>appengine-gcs-client</artifactid> <version>0.4</version> </dependency> <dependency> <groupid>com.googlecode.objectify</groupid> <artifactid>objectify</artifactid> <version>5.0.3</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.jboss.resteasy</groupid> <artifactid>jaxrs-api</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-jackson2-provider</artifactid> <version>${resteasy.version}</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-core</artifactid> <version>${jackson.version}</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-databind</artifactid> <version>${jackson.version}</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.jaxrs</groupid> <artifactid>jackson-jaxrs-json-provider</artifactid> <version>${jackson.version}</version> </dependency> <!-- test dependencies --> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-testing</artifactid> <version>${appengine.target.version}</version> <scope>test</scope> </dependency> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-api-stubs</artifactid> <version>${appengine.target.version}</version> <scope>test</scope> </dependency> </dependencies> </dependencymanagement>
dependencies
<dependencies> <dependency> <groupid>com.google.code.findbugs</groupid> <artifactid>findbugs</artifactid> </dependency> <dependency> <groupid>org.reflections</groupid> <artifactid>reflections</artifactid> </dependency> <dependency> <groupid>com.google.guava</groupid> <artifactid>guava</artifactid> </dependency> <dependency> <groupid>com.google.inject</groupid> <artifactid>guice</artifactid> </dependency> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-api-1.0-sdk</artifactid> <version>${appengine.target.version}</version> </dependency> <dependency> <groupid>com.google.appengine.tools</groupid> <artifactid>appengine-gcs-client</artifactid> <version>0.4</version> </dependency> <dependency> <groupid>com.googlecode.objectify</groupid> <artifactid>objectify</artifactid> <version>5.0.3</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.jboss.resteasy</groupid> <artifactid>jaxrs-api</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-jackson2-provider</artifactid> <version>${resteasy.version}</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-core</artifactid> <version>${jackson.version}</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-databind</artifactid> <version>${jackson.version}</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.jaxrs</groupid> <artifactid>jackson-jaxrs-json-provider</artifactid> <version>${jackson.version}</version> </dependency> <!-- test dependencies --> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-testing</artifactid> <version>${appengine.target.version}</version> <scope>test</scope> </dependency> <dependency> <groupid>com.google.appengine</groupid> <artifactid>appengine-api-stubs</artifactid> <version>${appengine.target.version}</version> <scope>test</scope> </dependency> </dependencies>
Comments
Post a Comment