Java SecurityException 在更新到最新版本后找不到策略或框架文件

Java SecurityException Cannot locate policy or framework files after updating to latest version

我是这样启动的java

java -Djava.rmi.server.hostname=myhostname \
    -Djava.security.policy=/myprogram/java.policy \
    -Dcom.ibm.tools.attach.enable=no -jar \
    /myprogram/myjar.jar

java.policy的内容是

grant codeBase "file:/myprogram/myjar.jar" {
  permission java.security.AllPermission;
};

我安装了新版本的 IBM Java

# rpm -qi java-1_8_0-ibm
Version     : 1.8.0_sr5.10
Release     : 30.24.1
Source RPM  : java-1_8_0-ibm-1.8.0_sr5.10-30.24.1.nosrc.rpm
Build Date  : Sun 18 Mar 2018 02:44:37 PM MDT

现在我收到这条错误消息

Caused by: java.lang.SecurityException: Cannot locate policy or framework files!
    at javax.crypto.b.c(Unknown Source)
    ...

我使用的先前版本没有显示相同的故障

# rpm -qi java-1_8_0-ibm
Version     : 1.8.0_sr5.10
Release     : 30.16.1
Source RPM  : java-1_8_0-ibm-1.8.0_sr5.10-30.16.1.nosrc.rpm
Build Date  : Tue 27 Feb 2018 10:22:44 AM MST

发行说明说

RPM 文件列表包含有限和无限策略文件

# rpm -ql java-1_8_0-ibm
/usr/lib64/jvm-private/java-1.8.0-ibm/jce/vanilla/limited/US_export_policy.jar
/usr/lib64/jvm-private/java-1.8.0-ibm/jce/vanilla/limited/local_policy.jar
/usr/lib64/jvm-private/java-1.8.0-ibm/jce/vanilla/unlimited/US_export_policy.jar
/usr/lib64/jvm-private/java-1.8.0-ibm/jce/vanilla/unlimited/local_policy.jar

For Java 8.0.5.10, Java 7.1.4.20, Java 7.0.10.20, Java 6.1.8.60, and onward, the restricted policy files are the default.

这解释了为什么现在对有限的策略文件进行符号链接。

我的解决方法是使用以下方法指定无限制的策略文件:

-Dcom.ibm.security.jurisdictionPolicyDir=/usr/lib64/jvm-private/java-1.8.0-ibm/jce/vanilla/unlimited