Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading org.apache.httpcomponents:httpcore version to >= 4.4.9 #11216

Closed
chaicho opened this issue Oct 4, 2023 · 0 comments · Fixed by #11293
Closed

Upgrading org.apache.httpcomponents:httpcore version to >= 4.4.9 #11216

chaicho opened this issue Oct 4, 2023 · 0 comments · Fixed by #11293
Labels
dependencies Pull requests that update a dependency file

Comments

@chaicho
Copy link
Contributor

chaicho commented Oct 4, 2023

Is your feature request related to a problem? Please describe.
When trying to build native image of a project with nacos-client as its transitive dependency, an exception will occur in the phase of native-image performing analysis like this.

Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Error loading a referenced type: java.lang.invoke.LambdaConversionException: Invalid receiver type interface org.apache.http.Header; not a subtype of implementation type interface org.apache.http.NameValuePair.

I inspected the problem and found that the problem lies in the version of httpcore pulled in transitively by nacos-client because i don't have any other httpcore dependency. The dependency tree looks like below.

[INFO] |  \- com.alibaba.nacos:nacos-client:jar:2.2.4:compile
[INFO] |     +- com.alibaba.nacos:nacos-auth-plugin:jar:2.2.4:compile
[INFO] |     +- com.alibaba.nacos:nacos-encryption-plugin:jar:2.2.4:compile
[INFO] |     +- commons-codec:commons-codec:jar:1.15:compile
[INFO] |     +- com.fasterxml.jackson.core:jackson-core:jar:2.12.6:compile
[INFO] |     +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.7.1:compile
[INFO] |     |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.7:compile
[INFO] |     +- org.apache.httpcomponents:httpasyncclient:jar:4.1.3:compile
[INFO] |     |  +- org.apache.httpcomponents:httpcore:jar:4.4.6:compile
[INFO] |     |  +- org.apache.httpcomponents:httpcore-nio:jar:4.4.6:compile
[INFO] |     |  +- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
[INFO] |     |  \- commons-logging:commons-logging:jar:1.2:compile
[INFO] |     \- io.prometheus:simpleclient:jar:0.12.0:compile
[INFO] |        +- io.prometheus:simpleclient_tracer_otel:jar:0.12.0:compile
[INFO] |        |  \- io.prometheus:simpleclient_tracer_common:jar:0.12.0:compile
[INFO] |        \- io.prometheus:simpleclient_tracer_otel_agent:jar:0.12.0:compile

I found that the class 'org.apache.http.Header' in httpcore is updated after 4.4.9 and changed its implementation. Here comes the problem, the official tool provided by graalvm analyzes httpcore of aversion >= 4.4.9 but nacos-client have 4.4.6. Compatibility problems arises, so the native image can't be built.

After i fix the version of httpcore to 4.4.9 in dependencyManagement block and add some reachability metadata, the native image is built successfully and is running smoothly,

Describe the solution you'd like
If upgrading httpcore won't affect nacos, i can raise a pr to fix it.

@KomachiSion KomachiSion added the dependencies Pull requests that update a dependency file label Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants