org/apache/http/util/Args(java.lang.NoClassDefFoundError).消息有效负载的类型为:字符串 [英] org/apache/http/util/Args (java.lang.NoClassDefFoundError). Message payload is of type: String

查看:118
本文介绍了org/apache/http/util/Args(java.lang.NoClassDefFoundError).消息有效负载的类型为:字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Mule应用程序能够与以下Maven依赖项一起运行.

My mule application is able to run with the following maven dependencies.

    <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"

It runs smoothly, however as soon as I send POST to it, it generates the "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中的类.尝试为要导入的库提供运行时的依赖范围.

Your error indicates that your application in missing a class in jar httpcore.4.4.1 during runtime. Try giving a dependency scope of runtime for your libraries that you are importing.

检查以下网址 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进行编译和运行,请使用范围提供".

If the jar is also required for compilation and runtime, use the scope "provided".

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

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

Please note that the default scope in maven (if nothing is specified) is compile, where in the library will be only used for compilation.

这篇关于org/apache/http/util/Args(java.lang.NoClassDefFoundError).消息有效负载的类型为:字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆