gpt4 book ai didi

java - org/apache/http/util/Args (java.lang.NoClassDefFoundError)。消息负载的类型为 : String

转载 作者:行者123 更新时间:2023-11-30 03:23:35 25 4
gpt4 key购买 nike

我的 mule 应用程序能够使用以下 Maven 依赖项运行。

    <dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.9.40</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
</dependency>

它运行顺利,但是一旦我向它发送 POST,它就会生成“NoClassDefFoundError”

<小时/>
ERROR 2015-06-11 12:34:10,406 [[dynamodb-01].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message : org/apache/http/util/Args (java.lang.NoClassDefFoundError). Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. org.apache.http.util.Args (java.lang.ClassNotFoundException)
java.net.URLClassLoader$1:366 (null)
2. org/apache/http/util/Args (java.lang.NoClassDefFoundError)
org.apache.http.conn.scheme.Scheme:90 (null)
3. org/apache/http/util/Args (java.lang.NoClassDefFoundError). Message payload is of type: String (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.ClassNotFoundException: org.apache.http.util.Args
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

最佳答案

您的错误表明您的应用程序在运行时缺少 jar httpcore.4.4.1 中的类。尝试为您要导入的库提供运行时依赖范围。

检查以下网址https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

<dependency> 
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
<scope>runtime</scope>
</dependency>

如果编译和运行时也需要该 jar,请使用“provided”范围。

<dependency> 
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
<scope>provided</scope>
</dependency>

请注意,maven 中的默认作用域(如果未指定任何内容)是compile,库中的作用域仅用于编译。

关于java - org/apache/http/util/Args (java.lang.NoClassDefFoundError)。消息负载的类型为 : String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30771696/

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