milenkovicm opened a new issue, #866:
URL: https://github.com/apache/arrow-java/issues/866

   ### 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
   
   
https://github.com/apache/arrow-java/blob/34060eb491a870f5ede5d30e007060b8310dc64f/c/src/main/cpp/jni_wrapper.cc#L60
   
   The issues are at:
   
   
https://github.com/apache/arrow-java/blob/34060eb491a870f5ede5d30e007060b8310dc64f/c/src/main/cpp/jni_wrapper.cc#L334-L342
   
   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.
   
   ```java
   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, 
   
   - 
https://docs.oracle.com/en/java/javase/11/docs/specs/jni/functions.html#findclass
   - 
https://docs.oracle.com/en/java/javase/21/docs/specs/jni/functions.html#findclass
   
   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 
   
   
https://github.com/apache/arrow-java/blob/34060eb491a870f5ede5d30e007060b8310dc64f/c/src/main/cpp/jni_wrapper.cc#L330-L331
   
   return error returned by `vm->GetEnv` rather than `JNI_ERR`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to