随笔 - 0, 文章 - 264, 评论 - 170, 引用 - 0
数据加载中……

Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x6cd0d970: Failure in SSL library, usually a protocol error

用asmack api连接openfire服务器的时候,报错如下:

12-11 22:21:53.759: W/System.err(18637): java.net.SocketException: Socket closed
12-11 22:21:53.759: W/System.err(18637):     at libcore.io.Posix.sendtoBytes(Native Method)
12-11 22:21:53.759: W/System.err(18637):     at libcore.io.Posix.sendto(Posix.java:151)
12-11 22:21:53.759: W/System.err(18637):     at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:177)
12-11 22:21:53.759: W/System.err(18637):     at libcore.io.IoBridge.sendto(IoBridge.java:473)
12-11 22:21:53.759: W/System.err(18637):     at java.net.PlainSocketImpl.write(PlainSocketImpl.java:507)
12-11 22:21:53.759: W/System.err(18637):     at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:46)
12-11 22:21:53.759: W/System.err(18637):     at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:269)
12-11 22:21:53.769: W/System.err(18637):     at java.io.OutputStreamWriter.flushBytes(OutputStreamWriter.java:167)
12-11 22:21:53.769: W/System.err(18637):     at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:158)
12-11 22:21:53.769: W/System.err(18637):     at java.io.BufferedWriter.flush(BufferedWriter.java:124)
12-11 22:21:53.769: W/System.err(18637):     at org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:195)
12-11 22:21:53.779: W/System.err(18637):     at org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:42)
12-11 22:21:53.779: W/System.err(18637):     at org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:78)
12-11 22:21:53.789: W/System.err(18637): XMPPError establishing connection with server.: remote-server-error(502) XMPPError establishing connection with server.
12-11 22:21:53.789: W/System.err(18637):   -- caused by: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x6cd0d970: Failure in SSL library, usually a protocol error
12-11 22:21:53.799: W/System.err(18637): error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error (external/openssl/ssl/s23_clnt.c:741 0x70770c38:0x00000000)
12-11 22:21:53.799: W/System.err(18637):     at org.jivesoftware.smack.XMPPConnection.initReaderAndWriter(XMPPConnection.java:714)
12-11 22:21:53.799: W/System.err(18637):     at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:850)
12-11 22:21:53.799: W/System.err(18637):     at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:268)
12-11 22:21:53.799: W/System.err(18637):     at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
12-11 22:21:53.799: W/System.err(18637):     at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
12-11 22:21:53.799: W/System.err(18637): Nested Exception: 
12-11 22:21:53.799: W/System.err(18637): javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x6cd0d970: Failure in SSL library, usually a protocol error
12-11 22:21:53.809: W/System.err(18637): error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error (external/openssl/ssl/s23_clnt.c:741 0x70770c38:0x00000000)
12-11 22:21:53.809: W/System.err(18637):     at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:420)
12-11 22:21:53.809: W/System.err(18637):     at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.<init>(OpenSSLSocketImpl.java:636)
12-11 22:21:53.809: W/System.err(18637):     at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:607)
12-11 22:21:53.809: W/System.err(18637):     at org.jivesoftware.smack.XMPPConnection.initReaderAndWriter(XMPPConnection.java:681)
12-11 22:21:53.809: W/System.err(18637):     at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:850)
12-11 22:21:53.819: W/System.err(18637):     at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:268)
12-11 22:21:53.819: W/System.err(18637):     at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
12-11 22:21:53.819: W/System.err(18637):     at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
12-11 22:21:53.819: W/System.err(18637): Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x6cd0d970: Failure in SSL library, usually a protocol error
12-11 22:21:53.819: W/System.err(18637): error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error (external/openssl/ssl/s23_clnt.c:741 0x70770c38:0x00000000)
12-11 22:21:53.819: W/System.err(18637):     at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
12-11 22:21:53.829: W/System.err(18637):     at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:378)
12-11 22:21:53.829: W/System.err(18637):      7 more
12-11 22:22:18.165: W/System.err(18637): java.lang.IllegalStateException: Not connected to server.
12-11 22:22:18.175: W/System.err(18637):     at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:488)
12-11 22:22:18.175: W/System.err(18637):     at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication.java:69)
12-11 22:22:18.175: W/System.err(18637):     at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:353)
12-11 22:22:18.175: W/System.err(18637):     at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:230)
12-11 22:22:18.175: W/System.err(18637):     at org.jivesoftware.smack.Connection.login(Connection.java:353)
12-11 22:22:18.175: W/System.err(18637):     at com.max.lobotou.MainActivity.onCreate(MainActivity.java:112)
12-11 22:22:18.185: W/System.err(18637):     at android.app.Activity.performCreate(Activity.java:5104)
12-11 22:22:18.185: W/System.err(18637):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
12-11 22:22:18.185: W/System.err(18637):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
12-11 22:22:18.185: W/System.err(18637):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-11 22:22:18.185: W/System.err(18637):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-11 22:22:18.185: W/System.err(18637):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
12-11 22:22:18.195: W/System.err(18637):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-11 22:22:18.195: W/System.err(18637):     at android.os.Looper.loop(Looper.java:137)
12-11 22:22:18.195: W/System.err(18637):     at android.app.ActivityThread.main(ActivityThread.java:5041)
12-11 22:22:18.195: W/System.err(18637):     at java.lang.reflect.Method.invokeNative(Native Method)
12-11 22:22:18.195: W/System.err(18637):     at java.lang.reflect.Method.invoke(Method.java:511)
12-11 22:22:18.195: W/System.err(18637):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-11 22:22:18.195: W/System.err(18637):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-11 22:22:18.205: W/System.err(18637):     at dalvik.system.NativeStart.main(Native Method)
12-11 22:22:18.205: I/java.lang.String(18637): java.lang.IllegalStateException: Not connected to server.

openfire服务器端解决办法:

“服务器设置”--“安全设置”---将“客户端安全联接”中由“非必须”,修改为“自定义”,另外把“旧的SSL方式”和“TLS方式”都设置为无效。

posted on 2013-12-11 23:33 小一败涂地 阅读(10859) 评论(0)  编辑  收藏 所属分类: IM、openfire


只有注册用户登录后才能发表评论。


网站导航: