Skip to content

Issue with arrow-c JNI and GraalVM 25 #866

Closed

Description

@milenkovicm

Describe the enhancement requested

I'm aware that graalvm is probably not supported, but I'm raising this as it might be simple fix.

There is a issue with env->FindClass in arrow-c when used with graalvm 25 (native image creates a shared library) Even all required classes are exposed for JNI in graalvm configuration env->FindClass wont be able to find a classes at

jclass local_class = env->FindClass(class_name);

The issues are at:

kObjectClass = CreateGlobalClassReference(env, "Ljava/lang/Object;");
kRuntimeExceptionClass =
CreateGlobalClassReference(env, "Ljava/lang/RuntimeException;");
kPrivateDataClass =
CreateGlobalClassReference(env, "Lorg/apache/arrow/c/jni/PrivateData;");
kCDataExceptionClass =
CreateGlobalClassReference(env, "Lorg/apache/arrow/c/jni/CDataJniException;");
kStreamPrivateDataClass = CreateGlobalClassReference(
env, "Lorg/apache/arrow/c/ArrayStreamExporter$ExportedArrayStreamPrivateData;");

where class names have L and ; at the start and end of the class name, so changing class names from Ljava/lang/Object; to java/lang/Object (and all other classes) will make problem go away.

kObjectClass = CreateGlobalClassReference(env, "java/lang/Object");
kRuntimeExceptionClass =
    CreateGlobalClassReference(env, "java/lang/RuntimeException");
kPrivateDataClass =
    CreateGlobalClassReference(env, "org/apache/arrow/c/jni/PrivateData");
kCDataExceptionClass =
    CreateGlobalClassReference(env, "org/apache/arrow/c/jni/CDataJniException");
kStreamPrivateDataClass = CreateGlobalClassReference(
    env, "org/apache/arrow/c/ArrayStreamExporter$ExportedArrayStreamPrivateData");

looking at the spec,

it says correct format is without L and ';' for non array classes.

I did manage to fix this in 18.1 which could be built locally, unfortunately I can't make 18.3 run locally as instructions at https://arrow.apache.org/docs/developers/java/building.html are outdated with change to new repo

also, one small request, can

if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION) != JNI_OK) {
return JNI_ERR;

return error returned by vm->GetEnv rather than JNI_ERR

Activity

  1. lidavidm commented on Oct 2, 2025

    @lidavidm
    Member

    Would you be willing to file a PR? Note that GraalVM is not a currently supported configuration (though we would appreciate contributions for that too)

  2. milenkovicm commented on Oct 2, 2025

    @milenkovicm
    ContributorAuthor

    I have no problem contributing; the issue is I could not set up the development environment to work with this version (I've used the version before you split to a new repo), so if there is up-to-date development setup, please let me know.

  3. milenkovicm commented on Oct 2, 2025

    @milenkovicm
    ContributorAuthor

    @lidavidm I have opened #867 that should fix error.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions