You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/07/25 13:39:38 UTC
[GitHub] LeoAugust19 opened a new issue #2134:
java.lang.NoClassDefFoundError in com.alibaba:dubbo-rpc-thrift,
due dependency conflict issue
LeoAugust19 opened a new issue #2134: java.lang.NoClassDefFoundError in com.alibaba:dubbo-rpc-thrift, due dependency conflict issue
URL: https://github.com/apache/incubator-dubbo/issues/2134
### Environment
* Dubbo version: com.alibaba:dubbo-rpc-thrift:jar:2.6.2
* Operating System version: Windows
* Java version: Jdk 1.7
### Descirption
Hi, there are two versions of **org.apache.httpcomponents:httpcore:jar** exist in com.alibaba:dubbo-rpc-thrift, and only **org.apache.httpcomponents:httpcore:jar:4.1.3** can be loaded during packaging process based on "nearest wins strategy". However, **class org.apache.http.util.Args** only included in **org.apache.httpcomponents:httpcore:jar:4.4.6:compile** which is shadowed by Maven. When your project referencing the missing class, java.lang.NoClassDefFoundError will be thrown.
### Dependency tree
com.alibaba:dubbo-rpc-thrift:jar:2.6.2
+- com.alibaba:dubbo-rpc-api:jar:2.6.2:compile
+- org.apache.thrift:libthrift:jar:0.8.0:compile
| +- org.slf4j:slf4j-api:jar:1.7.25:compile (version managed from 1.5.8)
| +- commons-lang:commons-lang:jar:2.5:compile
| +- org.apache.httpcomponents:httpclient:jar:4.5.3:compile (version managed from 4.1.2)
| | +- (org.apache.httpcomponents:httpcore:jar:4.4.6:compile - **omitted for conflict with 4.1.3**)
| | +- (commons-logging:commons-logging:jar:1.2:compile - version managed from 1.1.1; omitted for duplicate)
| | \- commons-codec:commons-codec:jar:1.9:compile
| \- org.apache.httpcomponents:httpcore:jar:4.1.3:compile
### Test case:
[RandomAccessByteArrayOutputStreamTest.txt](https://github.com/apache/incubator-dubbo/files/2228066/RandomAccessByteArrayOutputStreamTest.txt)
As the automatic test case generation tool can not deal with complex conditions, so before analyzing the source file, we mutated the program to allow-----
OutputStream out = new org.apache.http.impl.conn.LoggingOutputStream(new java.io.FileOutputStream("D:\\test.txt"),new org.apache.http.impl.conn.Wire(null));
in
method com.alibaba.dubbo.rpc.protocol.thrift.io.RandomAccessByteArrayOutputStream.writeTo(RandomAccessByteArrayOutputStream.java:93)
which is a reasonable condition.
Then we got the following stack trace.
### Stack trace:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/util/Args
at org.apache.http.impl.conn.Wire.output(Wire.java:110)
at org.apache.http.impl.conn.LoggingOutputStream.write(LoggingOutputStream.java:73)
at com.alibaba.dubbo.rpc.protocol.thrift.io.RandomAccessByteArrayOutputStream.writeTo(RandomAccessByteArrayOutputStream.java:93)
at com.alibaba.dubbo.rpc.protocol.thrift.io.RandomAccessByteArrayOutputStreamTest.main(RandomAccessByteArrayOutputStreamTest.java:11)
Caused by: java.lang.ClassNotFoundException: org.apache.http.util.Args
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
### Suggested solution
I found that you only deal with the dependency conflict issue for httpclient in version mangement file.
Could you please set the version of httpcore to 4.4.6 (dependencyManagement) in pom.xml?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org