在MyEclipse运行正常 在命令行运行报错
一个很简单的HTTPS连接程序,在MyEclipse中运行正常,没有任何问题。
但是在命令行中,用Java命令运行就会报错(不是因为包名没加,找不到类这样的错,谢谢)
具体信息如下:
Send GET request error!javax.net.ssl.SSLException: Server key
javax.net.ssl.SSLException: Server key
at sun.security.ssl.Handshaker.throwSSLException(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
at SendWeChatMessage.getAccessTokenForGet(SendWeChatMessage.java:160)
at SendWeChatMessage.sendWeChatMsgText(SendWeChatMessage.java:399)
at SendWeChatMessage.main(SendWeChatMessage.java:508)
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: MD5andSHA1withRSA, provider: SunJSSE, class: sun.security.ssl.RSASignature)
at java.security.Provider$Service.newInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.Signature.getInstance(Unknown Source)
at sun.security.ssl.JsseJce.getSignature(Unknown Source)
at sun.security.ssl.RSASignature.getInstance(Unknown Source)
at sun.security.ssl.HandshakeMessage$DH_ServerKeyExchange.<init>(Unknown Source)
... 13 more
Caused by: java.security.NoSuchAlgorithmException: NONEwithRSA Signature not available
at java.security.Signature.getInstance(Unknown Source)
at sun.security.ssl.JsseJce.getSignature(Unknown Source)
at sun.security.ssl.RSASignature.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
... 19 more
大概理解应该是运行命令时有环境没加、有路径没设置之类的问题导致的吧。
具体还需要知道的朋友解答一下,谢谢!