2017-04-27 10 views
0

私はミニジャバーボットを開発する必要があります。私はTLS接続ルールだけを持つオープンファイアサーバーを持っています。 コード:hava jabber-bot。 XLSP over smack 4.2.0 with TLS

XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder() 
       .setUsernameAndPassword("testjava", "12345678") 
       .setServiceName(server) 
       .setPort(5222) 
       .setHost(server)     .setSecurityMode(ConnectionConfiguration.SecurityMode.required) 
       .setDebuggerEnabled(true) 
       .build(); 

     AbstractXMPPConnection conn2 = new XMPPTCPConnection(config); 

     conn2.connect(); 

ログイン:

10:35:31 AM SENT (0): <stream:stream xmlns='jabber:client' to='***.pro' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='[email protected]***.pro' xml:lang='en'> 
10:35:31 AM RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="***.pro" id="xb9bamjxw" xml:lang="en" version="1.0"> 
10:35:32 AM RECV (0): <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms></stream:features> 
10:35:32 AM SENT (0): <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'></starttls> 
10:35:32 AM RECV (0): <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/> 
Exception in thread "main" org.jivesoftware.smack.SmackException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 
    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1010) 
    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:937) 
    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:952) 
    at java.lang.Thread.run(Thread.java:745) 

私はピジンを使用してへの接続を確立している私は、例外を接続するが、持ってしてみてくださいhttp://www.igniterealtime.org/downloads/から最後の安定したビルドを - 私は4.2.0をピシャリするために使用しましたサーバ。 TLS認証をサポートするために私のコードに追加する必要はありますか?

+0

[Smack 4]が重複して「SSLHandshakeException:ValidatorException:SunCertPathBuilderException」がスローされる(http://stackoverflow.com/questions/25495368/smack-4-throws-sslhandshakeexception-validatorexception-suncertpathbuilderexc) – Flow

答えて

0

サーバーに「有効な」証明書がないようです。有効な証明書を購入するか、「信頼できない」証明書を許可するようにライブラリを構成します。

関連する問題