kohlschutter / junixsocket

Unix Domain Sockets in Java 7 and newer (AF_UNIX), AF_TIPC, AF_VSOCK, and more
Apache License 2.0
433 stars 114 forks source link

two error about GraalVM native-image AOT/ahead-of-time compilation #124

Closed wzzc-dev closed 1 year ago

wzzc-dev commented 1 year ago

first : Could not resolve org.newsclub.net.unix.tipc.AFTIPCDatagramSocket for reflection configuration. Reason: java.lang.ClassNotFoundException: org.newsclub.net.unix.tipc.AFTIPCDatagramSocket., This becomes a warning after adding parameters -H:+AllowIncompleteClasspath

second: Error: Error parsing serialization configuration in jar:file:/builds/bp/box/services/eulixspace-gateway/target/eulixspace-gateway-1.0.0-SNAPSHOT-native-image-source-jar/lib/com.kohlschutter.junixsocket.junixsocket-common-2.6.1.jar!/META-INF/native-image/com.kohlschutter.junixsocket/junixsocket-common/serialization-config.json: first level of document must be an array of serialization lists Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option **SerializationConfigurationResources.**

wzzc-dev commented 1 year ago

org.newsclub.net.unix.AFSocketCapabilityRequirement, The interface was not compiled and generated under the test directory, so the class was not found when pom was introduced

wzzc-dev commented 1 year ago

org.newsclub.net.unix.AFSocketCapabilityRequirement in test dir,Imported via pom without this file

image

wzzc-dev commented 1 year ago

After upgrade to the latest version of graalvm, there was a Fatal error: org.graalvm.com piler. Debug. GraalError: com.oracle.svm.util.ReflectionUtil$ReflectionUtilError: java.lang.NoSuchMethodException: org.newsclub.net.unix.vsock.AFVSOCKDatagramSocketImpl.peekData(java.net.DatagramPacket)

kohlschuetter commented 1 year ago

Thanks for reporting!

I think the peekData error is related to https://github.com/oracle/graal/issues/2468 Please try with the Java 19 version of GraalVM.

Also see commit 3f1457e6cb8157e95d7d767c9986f9d079181244 where I added some entries missing when TIPC/VSOCK are enabled.

AFSocketCapabilityRequirement: This isn't required for users of the library, only for the selftest, and it should already work.

Please let me know if you're still having issues with the Java 19 version of GraalVM.

kohlschuetter commented 1 year ago

(when trying 2.7.0-SNAPSHOT, be sure to build with the "use-snapshots" Maven profile (e.g., "mvn clean install -Puse-snapshots" because we depend on another snapshot POM), alternatively cherry-pick https://github.com/kohlschutter/junixsocket/commit/3f1457e6cb8157e95d7d767c9986f9d079181244

kohlschuetter commented 1 year ago

@wang-zhichuang Please verify with junixsocket 2.6.2, thanks! Closing as assumed-fixed. Re-open if the problem still occurs in 2.6.2