Am using spring-data-dynamoDB project from here, as per its pom.xml they have used 1.6.9.1 version of aws-java-sdk, but I need to use latest version of aws-java-sdk for my project for using some of its features to implement Amazon s3 too. If I include its dependency,
我在这里使用spring-data-dynamoDB项目,根据它的pom.xml,他们使用了aws-java-sdk的1.6.9.1版本,但我需要使用最新版本的aws-java-sdk来实现我的项目它的功能也实现了亚马逊s3。如果我包含它的依赖,
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.7.9</version>
</dependency>
am getting an exception as follows,
我得到如下例外,
12:51:25.298 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean '(inner bean)': [_relProvider]
12:51:25.307 [main] ERROR o.s.w.c.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.hateoas.config.HypermediaSupportBeanDefinitionRegistrar$Jackson2ModuleRegisteringBeanPostProcessor#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_halObjectMapper': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.fasterxml.jackson.databind.ObjectMapper]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) ~[spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
.......
.......
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_halObjectMapper': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.fasterxml.jackson.databind.ObjectMapper]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076) ~[spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
.......
.......
I have tried exclusions as follows and also the same result,
我已尝试排除如下,也是相同的结果,
<dependency>
<groupId>org.socialsignin</groupId>
<artifactId>spring-data-dynamodb</artifactId>
<version>1.0.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
</exclusion>
</exclusions>
</dependency>
Is it possible to use latest version of aws-java-sdk in my project now?? or else spring-data-dynamoDB pom.xml have to be updated if so only I am able to use it or what?? Thanks Michaellavelle for that tremendous project. It helps me alot for completing DynamoDB part.
现在可以在我的项目中使用最新版本的aws-java-sdk吗?或者必须更新spring-data-dynamoDB pom.xml,如果是这样,我只能使用它或者什么?感谢Michaellavelle这个巨大的项目。它有助于我完成DynamoDB部分。
3 个解决方案
#1
18
Thanks you @user944849. The problem is jackson libs used in aws-java-sdk which is lower version as of in spring-data-rest-webmvc and conflicts with it, so by excluding jackson libs from aws-java-sdk builds correct. Solution I got is,
谢谢你@ user944849。问题是在aws-java-sdk中使用的jackson libs是spring-data-rest-webmvc中的较低版本并与之冲突,所以通过从aws-java-sdk构建正确排除jackson libs。我得到的解决方案是,
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.7.9</version>
<exclusions>
<exclusion>
<artifactId>jackson-core</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-annotations</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
</exclusions>
</dependency>
I am unable to post an answer early because of reputation. This may be useful for others who stuck as like me. Thank you.
由于声誉,我无法提前回复。对于像我一样坚持的人来说,这可能会有用。谢谢。
#2
2
For some reason excluding jackson from aws-java didn't work for me.
出于某种原因,从aws-java中排除jackson并不适合我。
java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
Looking at the issue, it looks like jackson is not available, or we have the wrong version floating around in the project. This method appears to have been added in 2.3.0, the latest version of jackson. I added a dependency to the latest version of jackson, and my code is now happy.
看看这个问题,看起来像jackson不可用,或者我们在项目中有错误的版本。这种方法似乎已经在2.3.0中添加,这是jackson的最新版本。我添加了对最新版jackson的依赖,现在我的代码很高兴。
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.9.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.3.0</version>
</dependency>
I'm not sure if annotation and databind are necessary. Also, I'm working on a huge project, so different forms of jackson might be coming in from various other dependencies, jersey, google-http-client-jackson2. So, it's also wise to look at the maven dependency graph to see where any jackson's are coming from.
我不确定是否需要注释和数据绑定。此外,我正在开展一个庞大的项目,因此不同形式的杰克逊可能会从各种其他依赖项,jersey,google-http-client-jackson2进来。因此,查看maven依赖图以查看jackson的来源也是明智之举。
#3
2
The error is NoClassDefFound for com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering
. I searched for that class in GrepCode and discovered it is in the com.fasterxml.jackson.core:jackson-core
library. My guess is that the two versions of the aws-java-sdk
library you tried are specifying different jackson-core library versions as transitive dependencies. Your application may be explicitly depending on jackson-core
as well - an older version than the one required by the later aws-java-sdk
. The project needs to use a version of jackson-core that contains the requiresPropertyOrdering method. You should be able to see all of the transitive dependencies by running mvn dependency:tree
(or the equivalent in your IDE).
com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering的错误是NoClassDefFound。我在GrepCode中搜索了该类,并发现它位于com.fasterxml.jackson.core:jackson-core库中。我的猜测是你尝试过的两个版本的aws-java-sdk库都指定了不同的jackson-core库版本作为传递依赖。您的应用程序可能也明确依赖于jackson-core - 比以后的aws-java-sdk所需的版本更旧。该项目需要使用包含requiresPropertyOrdering方法的jackson-core版本。您应该能够通过运行mvn dependency:tree(或IDE中的等效项)来查看所有传递依赖项。
One fix is to add the jackson-core
library to a <dependencyManagement>
block in the project's POM (or the parent POM) to make sure the right version gets used.
一个解决方法是将jackson-core库添加到项目的POM(或父POM)中的
#1
18
Thanks you @user944849. The problem is jackson libs used in aws-java-sdk which is lower version as of in spring-data-rest-webmvc and conflicts with it, so by excluding jackson libs from aws-java-sdk builds correct. Solution I got is,
谢谢你@ user944849。问题是在aws-java-sdk中使用的jackson libs是spring-data-rest-webmvc中的较低版本并与之冲突,所以通过从aws-java-sdk构建正确排除jackson libs。我得到的解决方案是,
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.7.9</version>
<exclusions>
<exclusion>
<artifactId>jackson-core</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-annotations</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
</exclusions>
</dependency>
I am unable to post an answer early because of reputation. This may be useful for others who stuck as like me. Thank you.
由于声誉,我无法提前回复。对于像我一样坚持的人来说,这可能会有用。谢谢。
#2
2
For some reason excluding jackson from aws-java didn't work for me.
出于某种原因,从aws-java中排除jackson并不适合我。
java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
Looking at the issue, it looks like jackson is not available, or we have the wrong version floating around in the project. This method appears to have been added in 2.3.0, the latest version of jackson. I added a dependency to the latest version of jackson, and my code is now happy.
看看这个问题,看起来像jackson不可用,或者我们在项目中有错误的版本。这种方法似乎已经在2.3.0中添加,这是jackson的最新版本。我添加了对最新版jackson的依赖,现在我的代码很高兴。
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.9.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.3.0</version>
</dependency>
I'm not sure if annotation and databind are necessary. Also, I'm working on a huge project, so different forms of jackson might be coming in from various other dependencies, jersey, google-http-client-jackson2. So, it's also wise to look at the maven dependency graph to see where any jackson's are coming from.
我不确定是否需要注释和数据绑定。此外,我正在开展一个庞大的项目,因此不同形式的杰克逊可能会从各种其他依赖项,jersey,google-http-client-jackson2进来。因此,查看maven依赖图以查看jackson的来源也是明智之举。
#3
2
The error is NoClassDefFound for com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering
. I searched for that class in GrepCode and discovered it is in the com.fasterxml.jackson.core:jackson-core
library. My guess is that the two versions of the aws-java-sdk
library you tried are specifying different jackson-core library versions as transitive dependencies. Your application may be explicitly depending on jackson-core
as well - an older version than the one required by the later aws-java-sdk
. The project needs to use a version of jackson-core that contains the requiresPropertyOrdering method. You should be able to see all of the transitive dependencies by running mvn dependency:tree
(or the equivalent in your IDE).
com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering的错误是NoClassDefFound。我在GrepCode中搜索了该类,并发现它位于com.fasterxml.jackson.core:jackson-core库中。我的猜测是你尝试过的两个版本的aws-java-sdk库都指定了不同的jackson-core库版本作为传递依赖。您的应用程序可能也明确依赖于jackson-core - 比以后的aws-java-sdk所需的版本更旧。该项目需要使用包含requiresPropertyOrdering方法的jackson-core版本。您应该能够通过运行mvn dependency:tree(或IDE中的等效项)来查看所有传递依赖项。
One fix is to add the jackson-core
library to a <dependencyManagement>
block in the project's POM (or the parent POM) to make sure the right version gets used.
一个解决方法是将jackson-core库添加到项目的POM(或父POM)中的