jython 2.7.0 中的 SSLHandshakeException [重复]
Posted
技术标签:
【中文标题】jython 2.7.0 中的 SSLHandshakeException [重复]【英文标题】:SSLHandshakeException in jython 2.7.0 [duplicate] 【发布时间】:2016-06-07 18:22:05 【问题描述】:当我尝试使用 jython 独立 2.7.0 执行以下代码时,我得到 javax.net.ssl.SSLHandshakeException: General SSLEngine problem,
import jsonrpclib
url = 'https://userName:Password@host/'
ss = jsonrpclib.Server( url )
result = ss.runCmds( 1, [ "cmd" : "<command>" ] )
print result
例外:
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "/jython/Lib/jsonrpclib/jsonrpc.py", line 288, in __call__
return self.__send(self.__name, args)
File "/jython/Lib/jsonrpclib/jsonrpc.py", line 237, in _request
response = self._run_request(request)
File "/jython/Lib/jsonrpclib/jsonrpc.py", line 251, in _run_request
response = self.__transport.request(
File "/jython/Lib/xmlrpclib.py", line 1264, in request
return self.single_request(host, handler, request_body, verbose)
File "/jython/Lib/xmlrpclib.py", line 1292, in single_request
self.send_content(h, request_body)
File "/jython/Lib/jsonrpclib/jsonrpc.py", line 126, in send_content
connection.endheaders()
File "/jython/Lib/httplib.py", line 997, in endheaders
self._send_output(message_body)
File "/jython/Lib/httplib.py", line 850, in _send_output
self.send(msg)
File "/jython/Lib/httplib.py", line 812, in send
self.connect()
File "/jython/Lib/httplib.py", line 1204, in connect
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
File "/jython/Lib/_socket.py", line 357, in handle_exception
return method_or_function(*args, **kwargs)
File "/jython/Lib/_socket.py", line 357, in handle_exception
return method_or_function(*args, **kwargs)
File "/jython/Lib/ssl.py", line 287, in wrap_socket
return SSLSocket(
File "/jython/Lib/ssl.py", line 116, in __init__
self.do_handshake()
File "/jython/Lib/ssl.py", line 165, in do_handshake
raise SSLError(SSL_ERROR_SSL, e.strerror)
_socket.SSLError: [Errno 1] General SSLEngine problem (javax.net.ssl.SSLHandshakeException: General SSLEngine problem)
相同的代码在 python 中也能正常工作。
【问题讨论】:
【参考方案1】:这是因为您没有指定 SSL 证书。 您可以通过多种方式绕过证书,寻找它们。在scala中寻找以下代码,我在scala中做同样的事情。可以帮到你。
https://gist.github.com/junaidk/237e49c36b3752a29597
【讨论】:
谢谢。我通过遵循在 Jython (tech.pedersen-live.com/2010/10/…) 中信任所有证书的帖子解决了这个问题以上是关于jython 2.7.0 中的 SSLHandshakeException [重复]的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 Jython/PyDev 修复 Eclipse Kepler/Luna 中的 UnsupportedCharsetException?