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

NoClassDefFoundError: com.oracle.svm.core.c.function.CEntryPointNativeFunctions #8851

Open
JiangWork opened this issue Apr 29, 2024 · 2 comments
Assignees

Comments

@JiangWork
Copy link

Hi, Team.

I am writing following code to use detachAllThreadsAndTearDownIsolate function.

@CEntryPoint(name = "Java_com_paypal_risk_engine_shared_HeapNativeImageAccess_detachAllAndTearDownIsolate")
//    @CEntryPointOptions(prologue = CEntryPointOptions.NoPrologue.class, epilogue = CEntryPointOptions.NoEpilogue.class)
    public static int detachAllAndTearDownIsolate(JNI.JNIEnv jniEnv, Pointer clazz, @CEntryPoint.IsolateThreadContext long isolateId, IsolateThread isolateThreadId) {
        System.out.println("detachAllAndTearDownIsolate>>");
        try {
            return CEntryPointNativeFunctions.detachAllThreadsAndTearDownIsolate(isolateThreadId);
        } catch (Throwable throwable) {
            throwable.printStackTrace();
            throw throwable;
        }
    }

I can successfully build the shared so file. But when i call this method, it will throw exception:

java.lang.NoClassDefFoundError: com.oracle.svm.core.c.function.CEntryPointNativeFunctions
	at com.paypal.risk.engine.shared.HeapNativeImageShared.detachAllAndTearDownIsolate(HeapNativeImageShared.java:58)

Any idea?

@oubidar-Abderrahim
Copy link
Member

Thanks for raising this, @JiangWork . Unfortunately, the information that you have provided is not sufficient for us to determine what is going wrong in your application. could you please share some details:

What version of GraalVM you're using? what OS and architecture?
Do you collect the Metadata for your application as mentioned here: https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/
Finally can you share a complete reproducer to this issue?

@JiangWork
Copy link
Author

hi, @oubidar-Abderrahim

The graalvm version is: graalvm-jdk-21.0.1+12.1
Os: macos

I have attached simple project code, reproduce step:

  1. mvn clean package
  2. native-image -jar target/native-expr-0.1-jar-with-dependencies.jar --shared -H:Name=libnativeimpl
  3. then run: Native.class

And output will be like:
Hello
0
detachAllAndTearDownIsolate>>

java.lang.NoClassDefFoundError: com.oracle.svm.core.c.function.CEntryPointNativeFunctions
	at org.graalvm.nativeimage.expr.impl.NativeImpl.detachAllAndTearDownIsolate(NativeImpl.java:37)
java.lang.NoClassDefFoundError: com.oracle.svm.core.c.function.CEntryPointNativeFunctions
    at org.graalvm.nativeimage.expr.impl.NativeImpl.detachAllAndTearDownIsolate(NativeImpl.java:37)

Attachment: java.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants