当前位置: 技术问答>java相关
######紧急求助!!!用java程序访问https站点的问题!!!!######
来源: 互联网 发布时间:2015-04-01
本文导语: 环境:操作系统是windows2000 pro中文版,jdk1.4beta3版,apache1.3.22 tomcat4.0.1。 状态:现在我的https环境已经搭建成功,也就是说我可以在浏览器地址栏里可以 用https://localhost:8443和http://localhost:8080访问tomcat...
环境:操作系统是windows2000 pro中文版,jdk1.4beta3版,apache1.3.22
tomcat4.0.1。
状态:现在我的https环境已经搭建成功,也就是说我可以在浏览器地址栏里可以
用https://localhost:8443和http://localhost:8080访问tomcat了
问题:我有一段java程序可以对http://localhost:8080正常发送post,get请求,
但不能对https://localhost:8443正常发送,程序抛出异常为:
javax.net.ssl.SSLHandshakeException: Couldn't find trusted certificate
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(DashoA6275)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
at java.io.OutputStream.write(OutputStream.java:61)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:503)
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl.getOutputStream(DashoA6275)
at TestHttps.main(TestHttps.java:34)
那位能帮我调试通过?我很着急呀!还有几天就要交程序了,帮帮忙吧!
tomcat4.0.1。
状态:现在我的https环境已经搭建成功,也就是说我可以在浏览器地址栏里可以
用https://localhost:8443和http://localhost:8080访问tomcat了
问题:我有一段java程序可以对http://localhost:8080正常发送post,get请求,
但不能对https://localhost:8443正常发送,程序抛出异常为:
javax.net.ssl.SSLHandshakeException: Couldn't find trusted certificate
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.b(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(DashoA6275)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)
at java.io.OutputStream.write(OutputStream.java:61)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:503)
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl.getOutputStream(DashoA6275)
at TestHttps.main(TestHttps.java:34)
那位能帮我调试通过?我很着急呀!还有几天就要交程序了,帮帮忙吧!
|
java.sun.com/products/jsse
has examples.
has examples.
|
http://www-900.ibm.com/developerWorks/java/jw-tips/tip096/index.shtml
|
呵呵,我运行你上面的代码的结果是:
java.net.SocketException: Default SSL context init failed: null
at javax.net.ssl.DefaultSSLSocketFactory.createSocket([DashoPro-V1.2-120
198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.doConnect([Da
shoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.NetworkClient.openServer(
[DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpClient.d([DashoPro-V1
.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpClient.([DashoP
ro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.([Dasho
Pro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V
1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V
1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.connec
t([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.getOut
putStream([DashoPro-V1.2-120198])
at TestHttps.main(TestHttps.java:27)
java.net.SocketException: Default SSL context init failed: null
at javax.net.ssl.DefaultSSLSocketFactory.createSocket([DashoPro-V1.2-120
198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.doConnect([Da
shoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.NetworkClient.openServer(
[DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpClient.d([DashoPro-V1
.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpClient.([DashoP
ro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.([Dasho
Pro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V
1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V
1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.connec
t([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.getOut
putStream([DashoPro-V1.2-120198])
at TestHttps.main(TestHttps.java:27)
|
这儿有很详细的资料
http://www.onjava.com/pub/a/onjava/2001/05/03/java_security.html
http://www.onjava.com/pub/a/onjava/2001/05/03/java_security.html
|
是不是SSL认证的问题啊?
|
ipipipippiui
|
ghmkhjj
|
晚上回家帮你试试
|
阅~
|
我没有遇到这样的错误,我这里是可以用get post 调用https//*.jsp的!