gpt4 book ai didi

java - AWS SQS:java.lang.NoClassDefFoundError:com/fasterxml/jackson/annotation/JsonMerge?

转载 作者:行者123 更新时间:2023-12-01 14:20:43 25 4
gpt4 key购买 nike

我正在尝试通过Java代码向SQS发送消息,如下所示:

public void pushToSQS(){

String queueURL = "https://sqs.us-east-1.amazonaws.com/205135634997/myQueue.fifo";

try {

final AmazonSQS sqs = AmazonSQSClientBuilder.defaultClient();

sqs.sendMessage(new SendMessageRequest(queueURL,
"test message"));

} catch (final AmazonServiceException e) {
log.error("Error: " + e.getMessage());
}
}
但是在以下行: final AmazonSQS sqs = AmazonSQSClientBuilder.defaultClient();我得到错误:
java.lang.NoClassDefFoundError: com/fasterxml/jackson/annotation/JsonMerge
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.annotation.JsonMerge
我在pom.xml中添加了以下内容:
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-models</artifactId>
<version>1.11.86</version>
</dependency>
以下是项目中的所有 jackson依赖项:
enter image description here
mvn依赖关系树中,我可以看到:
+- org.jboss.resteasy:resteasy-multipart-provider:jar:3.0.19.Final:provided
[INFO] | +- org.jboss.resteasy:resteasy-client:jar:3.0.19.Final:provided
[INFO] | +- org.jboss.resteasy:resteasy-jaxb-provider:jar:2.3.5.Final:provided
[INFO] | | \- com.sun.xml.bind:jaxb-impl:jar:2.2.5.jboss-1:provided
[INFO] | | +- com.sun.istack:istack-commons-runtime:jar:2.6.1:provided
[INFO] | | \- com.sun.xml.txw2:txw2:jar:20110809:provided
[INFO] | +- com.sun.mail:javax.mail:jar:1.5.5:provided
[INFO] | \- org.apache.james:apache-mime4j:jar:0.6:provided
[INFO] \- org.jboss.resteasy:resteasy-jackson2-provider:jar:3.0.19.Final:provided
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.6.3:provided
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.3:provided
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.3:provided
[INFO] \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.6.3:provided
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.6.3:provided
[INFO] \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.6.3:provided


[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
是什么导致此错误?

最佳答案

好像您有两次 jackson 。考虑一下:

+- org.jboss.resteasy:resteasy-multipart-provider:jar:3.0.19.Final:provided
[INFO] \- org.jboss.resteasy:resteasy-jackson2-provider:jar:3.0.19.Final:provided
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.6.3:provided
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.3:provided
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.3:provided
[INFO] \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.6.3:provided
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.6.3:provided
[INFO] \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.6.3:provided
还有这个:
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile
请将顶级依赖项放到 com.fasterxml.jackson.core:jackson-databind:jar:2.9.6上,看看它是否有效。

关于java - AWS SQS:java.lang.NoClassDefFoundError:com/fasterxml/jackson/annotation/JsonMerge?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62678885/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com