简体   繁体   English

在Google App Engine中禁用TLS / SSL检查-Java

[英]Disable TLS/SSL check in Google App Engine - Java

My app is getting this error when accessing a HTTPS resource (using appengine-java-sdk-1.9.63 ): 访问HTTPS资源(使用appengine-java-sdk-1.9.63 )时,我的应用程序遇到此错误:

javax.net.ssl.SSLHandshakeException: Could not verify SSL certificate for URL: https://some.where/
        at com.google.appengine.api.urlfetch.URLFetchServiceImpl.convertApplicationException(URLFetchServiceImpl.java:175)
        at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:45)
        at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:543)
        at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:422)
        at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getResponseCode(URLFetchServiceStreamHandler.java:275)
        at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:656)
        at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:629)
        at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:261)
        at org.jsoup.helper.HttpConnection.get(HttpConnection.java:250)

What can be done so GAE would not check of SSL since in my current purpose for the app, it does not care if it connects via HTTP or HTTPS, so in my case I just want to disable SSL check. 可以做些什么,以便GAE不会检查SSL,因为在我目前用于该应用程序的用途中,它并不关心它是否通过HTTP或HTTPS连接,因此在我的情况下,我只想禁用SSL检查。

Update: 更新:

I am running the application from Windows (Linux does not throw the error above) 我正在从Windows运行应用程序(Linux不会抛出以上错误)

Already I have modifiied the dev_appserver.cmd like this: 我已经像这样修改了dev_appserver.cmd

java -Ddeployment.security.TLSv1.1=false -Ddeployment.security.TLSv1.2=false -cp "%~dp0\..\lib\appengine-tools-api.jar" ^
    com.google.appengine.tools.KickStart ^
       com.google.appengine.tools.development.DevAppServerMain %*

Also in the application itself this is set: 同样在应用程序本身中进行了设置:

FetchOptions fetchOptions = FetchOptions.Builder.doNotValidateCertificate();
HTTPRequest request = new HTTPRequest(getUrl, HTTPMethod.GET, fetchOptions)

What could be wrong with Windows that it throws the error whereas in Linux there is no problem? Windows会引发错误,而Linux中没有问题,这可能是什么问题呢?

The solution that worked for this problem is to update the JDK of the machine. 解决此问题的解决方案是更新计算机的JDK。 Then after upgrading from Java 7 to Java 8, the SSLHandshakeException is not being thrown anymore. 然后,从Java 7升级到Java 8后,不再抛出SSLHandshakeException

Thus, problem solved. 这样,问题就解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM