<@U078Y59KC3B> when i publish a message to pulsar ...
# ask-ai
i
@RunLLM when i publish a message to pulsar using the Java library, i get an exception logged to the console:
Copy code
c.s.circe.checksum.Java9IntHash -- Unable to use reflected methods:
java.lang.reflect.InaccessibleObjectException: Unable to make private static int java.util.zip.CRC32C.updateBytes(int,byte[],int,int) accessible: module java.base does not "opens java.util.zip" to unnamed module
what causes it and how do i resolve it? i can provide the full stack trace if it helps
r
This error occurs because, starting with Java 9+, access to certain internal JDK classes (like java.util.zip.CRC32C) is restricted by the module system. The Pulsar Java client (via BookKeeper's circe-checksum) tries to use reflection for optimized CRC32C checksum calculation, but fails unless the JVM is started with the appropriate --add-opens flags to open the java.util.zip module to unnamed modules. Without these flags, it falls back to a slower, pure Java implementation and logs this warning, but functionality is not broken. To resolve the warning, add the following JVM argument when starting your application: --add-opens java.base/java.util.zip=ALL-UNNAMED For Pulsar Functions or runtimes, you may also need: --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED According to Pulsar PR #22910 and BookKeeper PR #3234, these flags enable the optimized checksum path and remove the warning. Would you like more detail or help with where to add these flags? Sources: - Pulsar PR #22910 - BookKeeper PR #3234 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
i
@RunLLM those links are helpful, but i don't see them listed on the official java client setup guide here: https://pulsar.apache.org/docs/next/client-libraries-java-setup/#enabling-optimized-netty-direct-memory-buffer-access is there a full list of recommended JVM options/params for a project using the pulsar client?
r
The official Pulsar Java client setup guide recommends these JVM options for optimized Netty direct memory buffer access and to avoid direct buffer memory errors:
Copy code
--add-opens java.base/java.nio=ALL-UNNAMED
--add-opens java.base/jdk.internal.misc=ALL-UNNAMED
For high-throughput or checksum optimization, you should also add:
Copy code
--add-opens java.base/java.util.zip=ALL-UNNAMED
This is not explicitly listed in the official guide, but is required for optimized CRC32C checksum as discussed in Pulsar PR #22910. Other recommended options for performance tuning (heap, direct memory, GC) are described in StreamNative advanced configuration. Would you like a breakdown of these JVM options or more detail on tuning for your use case? Sources: - Pulsar Java client setup guide - Pulsar PR #22910 - StreamNative advanced configuration 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.