[
https://issues.apache.org/jira/browse/KYLIN-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17163407#comment-17163407
]
Gabor Arki edited comment on KYLIN-4656 at 7/23/20, 10:24 AM:
--------------------------------------------------------------
[~zhangyaqian] because you are excluding it from the dependencies of the
released pom, but not from the shading itself.
* Instead of providing an exclude list and shade everything else into the jdbc
jar:
{noformat}
<artifactSet>
<excludes>
<exclude>org.slf4j:jcl-over-slf4j:*</exclude>
</excludes>
</artifactSet>{noformat}
You should define an include list and shade only that you actually intend to
shade:
{noformat}
<artifactSet>
<includes>
<include>org.apache.kylin:kylin-shaded-guava</include>
<include>org.apache.calcite.avatica:avatica-core</include>
<include>org.apache.calcite.avatica:avatica-metrics</include>
<include>com.fasterxml.jackson.core:jackson-annotations</include>
<include>com.fasterxml.jackson.core:jackson-core</include>
<include>com.fasterxml.jackson.core:jackson-databind</include>
<include>com.google.protobuf:protobuf-java</include>
<include>org.apache.httpcomponents:httpclient</include>
<include>org.apache.httpcomponents:httpcore</include>
<include>commons-codec:commons-codec</include>
<include>commons-logging:commons-logging</include>
</includes>
</artifactSet>{noformat}
This set is the one that seems to be included in 3.0.2, not sure if everything
is actually needed or not.
* Also, the relocation in the kylin-shaded-guava module is not complete:
{noformat}
<pattern>com.google.common</pattern>
<shadedPattern>${shadeBase}.com.google.common</shadedPattern>{noformat}
It relocated only the {{com.google.common}} package of guava, but keeps
{{com.google.thirdparty}} as is allowing again some classpath conflicts. Should
be:
{noformat}
<pattern>com.google</pattern>
<shadedPattern>${shadeBase}.com.google</shadedPattern>{noformat}
* These workarounds seem to fix the issue locally, but defining dependencies
in the [parent pom|https://github.com/apache/kylin/blob/master/pom.xml#L1095]
is still a bad practice because these are transitively also defined as
dependencies for anyone who is using your public libraries like kylin-jdbc.
was (Author: arkigabor):
[~zhangyaqian] because you are excluding it from the dependencies of the
released pom, but not from the shading itself.
* Instead of providing an exclude list and shade everything else:
{noformat}
<artifactSet>
<excludes>
<exclude>org.slf4j:jcl-over-slf4j:*</exclude>
</excludes>
</artifactSet>{noformat}
You should define an include list and shade only that you actually intend to
shade:
{noformat}
<artifactSet>
<includes>
<include>org.apache.kylin:kylin-shaded-guava</include>
<include>org.apache.calcite.avatica:avatica-core</include>
<include>org.apache.calcite.avatica:avatica-metrics</include>
<include>com.fasterxml.jackson.core:jackson-annotations</include>
<include>com.fasterxml.jackson.core:jackson-core</include>
<include>com.fasterxml.jackson.core:jackson-databind</include>
<include>com.google.protobuf:protobuf-java</include>
<include>org.apache.httpcomponents:httpclient</include>
<include>org.apache.httpcomponents:httpcore</include>
<include>commons-codec:commons-codec</include>
<include>commons-logging:commons-logging</include>
</includes>
</artifactSet>{noformat}
This set it the one that seems to be included in 3.0.2, not sure if everything
is actually needed or not.
* Also, the relocation in the kylin-shaded-guava module is not complete:
{noformat}
<pattern>com.google.common</pattern>
<shadedPattern>${shadeBase}.com.google.common</shadedPattern>{noformat}
It relocated only the {{com.google.common}} package of guava, but keeps
{{com.google.thirdparty}} as is allowing again some classpath conflicts. Should
be:
{noformat}
<pattern>com.google</pattern>
<shadedPattern>${shadeBase}.com.google</shadedPattern>{noformat}
* These workarounds seem to fix the issue locally, but defining dependencies in
the [parent pom|https://github.com/apache/kylin/blob/master/pom.xml#L1095] is
still a bad practice because these are transitively also defined as
dependencies for anyone who is using your public libraries like kylin-jdbc.
> Guava classpath conflict caused by kylin-jdbc 3.1.0 jar
> -------------------------------------------------------
>
> Key: KYLIN-4656
> URL: https://issues.apache.org/jira/browse/KYLIN-4656
> Project: Kylin
> Issue Type: Bug
> Components: Driver - JDBC
> Affects Versions: v3.1.0
> Reporter: Gabor Arki
> Priority: Critical
> Attachments: image-2020-07-23-07-44-40-675.png
>
>
> The newly released kylin-jdbc 3.1.0 jar contains a shaded, non-repackaged
> version of the Guava library. This is causing class duplication with the
> original guava jar if it is also on the classpath which results in
> non-deterministic, runtime errors depending on which version of a certain
> guava class has been picked up by the class-loader from the 2 versions. Based
> on the runtime errors of the missing classes and methods, it seems to be a
> very old version, probably <=14.
>
> Either implement a proper shading with package relocation or rely on
> transitive dependency, but do not shade non-repackaged versions of libraries.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)