在MyEclipse运行正常 在命令行运行报错

lwh_1024 2016-10-21 11:07:43
一个很简单的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

大概理解应该是运行命令时有环境没加、有路径没设置之类的问题导致的吧。
具体还需要知道的朋友解答一下,谢谢!
...全文
345 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
鲨鱼也是鱼 2016-10-26
  • 打赏
  • 举报
回复
找到了就结账吧
lwh_1024 2016-10-22
  • 打赏
  • 举报
回复
找到原因了:缺少包sunjce_provider.jar

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧