This is an automated email from the ASF dual-hosted git repository.
mmarshall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 9d16b91027f [fix][client] Fix JDK17 compatibility issue (#15964)
9d16b91027f is described below
commit 9d16b91027f2691949328b029bfceb58cddc92c9
Author: Guoxiong Li <[email protected]>
AuthorDate: Fri Jun 10 03:30:22 2022 +0800
[fix][client] Fix JDK17 compatibility issue (#15964)
Fixes #15349
### Motivation
When using the JDK17, pulsar-client throws exception `module java.base does
not export sun.net to unnamed module`, it is good to fix it.
### Modifications
Add `--add-opens java.base/sun.net=ALL-UNNAMED` to java option when using
JDK17.
### Verifying this change
- [x] Make sure that the change passes the CI checks.
### Documentation
Check the box below or label this PR directly.
Need to update docs?
- [x] `doc-not-needed`
---
bin/pulsar-client | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/bin/pulsar-client b/bin/pulsar-client
index 73f82df37b0..acdc262a1e2 100755
--- a/bin/pulsar-client
+++ b/bin/pulsar-client
@@ -94,6 +94,13 @@ PULSAR_CLASSPATH="`dirname
$PULSAR_LOG_CONF`:$PULSAR_CLASSPATH"
OPTS="$OPTS -Dlog4j.configurationFile=`basename $PULSAR_LOG_CONF`"
OPTS="$OPTS -Djava.net.preferIPv4Stack=true"
+IS_JAVA_8=`$JAVA -version 2>&1 |grep version|grep '"1\.8'`
+# Start --add-opens options
+# '--add-opens' option is not supported in jdk8
+if [[ -z "$IS_JAVA_8" ]]; then
+ OPTS="$OPTS --add-opens java.base/sun.net=ALL-UNNAMED"
+fi
+
OPTS="-cp $PULSAR_CLASSPATH $OPTS"
OPTS="$OPTS $PULSAR_EXTRA_OPTS"