我正在尝试 https 连接到远程 API,使用 Spring RestTemplate 进行连接。它是一个弹簧启动应用程序
我能够在我的本地(oracle JDK 1.8 和 tomcat)上建立连接
在使用 IBM JDK 1.8 的 Jboss EAP 7.1.0 GA 中部署为 war 时,连接超时并失败。下面的日志
SSLContextImpl: Using X509ExtendedKeyManager com.ibm.jsse2.az
SSLContextImpl: Using X509TrustManager com.ibm.jsse2.aD
JsseJCE: Using SecureRandom SHA2DRBG from provider IBMJCE version1.8
trigger seeding of SecureRandom
done seeding SecureRandom
Handling error: ResourceAccessException, I/O error on POST request for "https://example.com/auth":
A remote host did not respond within the timeout period. (Connection timed out);
nested exception is java.net.ConnectException: A remote host did not respond within the timeout period. (Connection timed out):
使用 oracle JDK 1.8 编译和打包的相同代码在上述 Jboss 环境中工作正常。
我认为这与 ssl 握手有关并尝试了所有这些选项,但没有解决我的问题。我记录了两个环境的 SSL 调试,在工作环境中,在完成 SecureRandom 播种后,我看到了服务器和客户端之间的算法和密码协商,但在 Jboss IBM JDK 1.8 中我什么也没看到。一段时间后,它因超时而失败
# JAVA_OPTS="$JAVA_OPTS -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2"
# JAVA_OPTS="$JAVA_OPTS -Djdk.tls.client.protocols=TLSv1.2"
# JAVA_OPTS="-Dcom.ibm.jsse2.renegotiate=DISABLED"
# JAVA_OPTS="-Djdk.tls.allowUnsafeServerCertChange=true"
# JAVA_OPTS="-Djdk.tls.disabledAlgorithms=SSLv3,TLSv1,TLSv1.1"
# JAVA_OPTS="$JAVA_OPTS -Dcom.ibm.jsse2.overrideDefaultTLS=true"
# JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=trustStore"*