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

Distributedlog Core Shaded Jar fails with a NoClassDefFoundError #2700

Closed
nicknezis opened this issue Apr 23, 2021 · 4 comments · Fixed by #4319
Closed

Distributedlog Core Shaded Jar fails with a NoClassDefFoundError #2700

nicknezis opened this issue Apr 23, 2021 · 4 comments · Fixed by #4319
Labels

Comments

@nicknezis
Copy link
Contributor

BUG REPORT

Describe the bug
After upgrading to a new version of distributedlog-core-shaded jar in Apache Heron, I ran into the following error message. It seems that some of the transitive dependencies are not being included in the shaded jar.

Caused by: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: dlshade/com/google/common/util/concurrent/internal/InternalFutureFailureAccess
	at org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:278)
	at org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:260)
	at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509)
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
	... 27 more

This is the list of transitive dependencies that are not being included. Is this by design? It seems that by not including the dependencies, but still shading all of com.google to dlshade.com.google there are bugs with the generated shaded jar.

❯ mvn install | grep -i excluding
[INFO] Excluding com.google.guava:failureaccess:jar:1.0.1 from the shaded jar.
[INFO] Excluding com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava from the shaded jar.
[INFO] Excluding org.checkerframework:checker-qual:jar:3.5.0 from the shaded jar.
[INFO] Excluding com.google.errorprone:error_prone_annotations:jar:2.4.0 from the shaded jar.
[INFO] Excluding com.google.j2objc:j2objc-annotations:jar:1.3 from the shaded jar.
[INFO] Excluding org.apache.yetus:audience-annotations:jar:0.5.0 from the shaded jar.
[INFO] Excluding org.jctools:jctools-core:jar:2.1.2 from the shaded jar.
[INFO] Excluding io.netty:netty-handler:jar:4.1.50.Final from the shaded jar.
[INFO] Excluding io.netty:netty-resolver:jar:4.1.50.Final from the shaded jar.
[INFO] Excluding io.netty:netty-transport:jar:4.1.50.Final from the shaded jar.
[INFO] Excluding io.netty:netty-codec:jar:4.1.50.Final from the shaded jar.
[INFO] Excluding io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.50.Final from the shaded jar.
[INFO] Excluding io.netty:netty-transport-native-unix-common:jar:4.1.50.Final from the shaded jar.
[INFO] Excluding io.netty:netty-tcnative-boringssl-static:jar:2.0.31.Final from the shaded jar.
[INFO] Excluding org.bouncycastle:bcpkix-jdk15on:jar:1.60 from the shaded jar.
[INFO] Excluding org.bouncycastle:bcprov-jdk15on:jar:1.60 from the shaded jar.
[INFO] Excluding org.bouncycastle:bcprov-ext-jdk15on:jar:1.60 from the shaded jar.
[INFO] Excluding com.beust:jcommander:jar:1.78 from the shaded jar.
[INFO] Excluding com.google.code.findbugs:jsr305:jar:3.0.2 from the shaded jar.
[INFO] Excluding org.slf4j:slf4j-api:jar:1.7.25 from the shaded jar.
[INFO] Excluding commons-configuration:commons-configuration:jar:1.10 from the shaded jar.
@eolivelli
Copy link
Contributor

Can you try to use the regular, non shaded I mean, jar?
Or if you need a single jar you could try to change here the pom.xml to disable relocation.

@nicknezis
Copy link
Contributor Author

I believe this is still an issue, but I was able to update our Apache Heron codebase to use the non-shaded jar. apache/incubator-heron#3692

@jameschen789
Copy link

It is a bug, shade jar should include com.google.guava:failureaccess

@mgodave
Copy link
Contributor

mgodave commented Mar 4, 2023

FWIW: Still a bug with the shaded jar

hezhangjian added a commit that referenced this issue Apr 28, 2024
Fix #2700 

## Changes

- shade jar should include com.google.guava:failureaccess.
- remove unused exclude dependency now.
Signed-off-by: ZhangJian He <shoothzj@gmail.com>
hezhangjian added a commit that referenced this issue May 25, 2024
Fix #2700

## Changes

- shade jar should include com.google.guava:failureaccess.
- remove unused exclude dependency now.
Signed-off-by: ZhangJian He <shoothzj@gmail.com>
(cherry picked from commit 459d440)
hezhangjian added a commit that referenced this issue May 25, 2024
Fix #2700

## Changes

- shade jar should include com.google.guava:failureaccess.
- remove unused exclude dependency now.
Signed-off-by: ZhangJian He <shoothzj@gmail.com>
(cherry picked from commit 459d440)
Ghatage pushed a commit to sijie/bookkeeper that referenced this issue Jul 12, 2024
Fix apache#2700 

## Changes

- shade jar should include com.google.guava:failureaccess.
- remove unused exclude dependency now.
Signed-off-by: ZhangJian He <shoothzj@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants