OpenShift上的OpenJDK:“NoSuchAlgorithmException:EC AlgorithmParameters not available”

我遇到了java.security.NoSuchAlgorithmException: EC AlgorithmParameters not available OpenShift上java.security.NoSuchAlgorithmException: EC AlgorithmParameters not available Wildfly 8.2(OpenJDK 1.8.0_31)的java.security.NoSuchAlgorithmException: EC AlgorithmParameters not available (AmazonHttpClient抛出exception)。

看起来OpenJDK 1.8和ECC存在一个错误: https ://bugzilla.redhat.com/show_bug.cgi?id = 1167153

根据建议的解决方法,需要编辑jre/lib/security/java.security以禁用jdk.tls.disabledAlgorithms=EC,ECDHE,ECDH 。 或者删除jre/lib/ext/sunec.jar

不幸的是我无法在OpenShift上执行此操作(缺少权限)。

这里最好的解决方法是什么? 我可以选择切换到没有这个问题的Oracle JDK(在OpenShift上)吗?

更新

我删除了Sun java.security.Provider-s并添加了BouncyCastle:

 static { Security.removeProvider("SunEC"); Security.removeProvider("SUN"); Security.removeProvider("SunJSSE"); // ... Security.addProvider(new BouncyCastleProvider()); } 

不幸的是,BouncyCastle 不是 JSSE提供者( 使用Bouncy Castle提供程序创建SSLContext实例 ), SSLContext.getInstance()NoSuchAlgorithmException: TLS SSLContext not available失败NoSuchAlgorithmException: TLS SSLContext not available

我也试过@Rudy De Busscher建议回答,虽然我不赞成手动设置env变量,因为它后来很容易被遗忘。 相反,我将JAVA_OPTS_EXT设置添加到$OPENSHIFT_DATA_DIR/.my_custom_env并在.openshift/action_hooks/pre_start挂钩中加载source ${OPENSHIFT_DATA_DIR}.my_custom_env 。 它没有用,但由于我仍然需要使用BouncyCastle for JSSE,我已经放弃了这个解决方案。

幸运的是,我能够切换回OpenJDK 1.7(通过.openshift/markers/java7 ),现在“解决”了这个问题。

找到了解决方案。

您可以定义属性文件以覆盖默认JRE文件jre/lib/security/java.security定义的一些键。

可以在OpenShift Gear的JAVA_OPTS_EXT环境属性中指定此文件。

这些是我们解决问题的步骤。

创建文件

  • rhc ssc gearName
  • cd $ OPENSHIFT_DATA_DIR
  • vi override_security.properties
  • 内容是jdk.tls.disabledAlgorithms=EC,ECDHE,ECDH
  • pwd – >并记下(复制)刚刚创建的文件的完整路径位置。
  • 出口

设置环境变量

  • rhc env set JAVA_OPTS_EXT = -Djava.security.properties = file: fileLocation -a gearName

重启你的装备/应用程序

  • rhc app restart -a gearName

这对我们起了作用。