我正在尝试https连接到远程API,使用Spring RestTemplate建立连接。它是一个Spring Boot应用程序
我能够在本地(Oracle JDK 1.8和tomcat)上建立连接
当作为战争部署在使用IBM JDK 1.8的Jboss EAP 7.1.0 GA中时,连接超时并失败。下面的日志
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):
在上面提到的Jboss环境中,用oracle JDK 1.8编译和打包的相同代码可以正常工作。
我认为这与ssl握手有关,并尝试了所有这些选项,但没有解决我的问题。我记录了两种环境的SSL调试,在工作环境中,我在完成SecureRandom的播种后看到服务器和客户端之间的Alogrithm和密码协商,但是在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"*