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

[java][0.2.0] java.lang.NoclassDefFoundError: com/google/common/base/Preconditions #996

Closed
jiangguilong2000 opened this issue Oct 10, 2023 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jiangguilong2000
Copy link

jiangguilong2000 commented Oct 10, 2023

when junittest case use the serializeJavaObject API,it throws exception as following:

java.lang.NoclassDefFoundError: com/google/common/base/Preconditions
at io.fury.type.Type.(Type.java:169)
at io.fury.type.Type.(Type.java:28
at io.fury.Fury.(Fury.java:85)
at io.gamioo.sandbox.ProtoTest.beforeAll(ProtoTest.java:44) <31 internal lines>
at java.base/java.util.ArrayList.forEach(ArrayList,java:1541) <23 internal lines>Create breakpoint : com.google.common.basePreconditions <2 internal lines>+Caused by: java.lang.ClassNotFoundExceptionat java.base/javalang.classLoader.loadclass(CassLoader,java:522)
... 59 more

I hope fury can get rid of this dependency about guava

Fury fury = Fury.builder().withLanguage(Language.JAVA).withRefTracking(true).requireClassRegistration(false).withNumberCompressed(false).build();
 byte[] bytes = fury.serializeJavaObject(skillFire_s2C_msg);

fury version:0.2.0
guava version:

implementation group: 'com.google.guava', name: 'guava', version: '32.1.1-jre'

jdk:

java -version
openjdk version "11.0.16.1-internal" 2022-08-12
OpenJDK Runtime Environment TencentKonaJDK (build 11.0.16.1-internal+2)
OpenJDK 64-Bit Server VM TencentKonaJDK (build 11.0.16.1-internal+2, mixed mode)

gradle:


Gradle 6.8.3

Build time: 2021-02-22 16:13:28 UTC
Revision: 9e26b4a9ebb910eaa1b8da8ff8575e514bc61c78

Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 11.0.16.1-internal (Tencent 11.0.16.1-internal+2)
OS: Windows 11 10.0 amd64

@jiangguilong2000 jiangguilong2000 added the bug Something isn't working label Oct 10, 2023
@chaokunyang
Copy link
Collaborator

This is a bug in gradle6. You can upgrade gradle to gradle 7. Or add following configs to build.gradle:

sourceSets.all {
  configurations.getByName(runtimeClasspathConfigurationName) {
    attributes.attribute(Attribute.of("org.gradle.jvm.environment", String), "standard-jvm")
  }
  configurations.getByName(compileClasspathConfigurationName) {
    attributes.attribute(Attribute.of("org.gradle.jvm.environment", String), "standard-jvm")
  }
}

See google/guava#6612 for more details.

@chaokunyang chaokunyang added the good first issue Good for newcomers label Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants