Project

General

Profile

about jaxmpp2 registration

shan wang
Added almost 4 years ago

The init file:

--virt-hosts = im.test.com
--auth-db-uri = jdbc:mysql://localhost:3306/tigasedb?user=root&password=root
--user-db-uri = jdbc:mysql://localhost:3306/tigasedb?user=root&password=root
#--sm-cluster-strategy-class = tigase.cluster.strategy.OnlineUsersCachingStrategy
--user-db = mysql
--admins = admin@im.test.com
--comp-name-6 = message-archive
--comp-name-5 = rest
--comp-name-4 = stun
--auth-db = tigase-auth
--comp-name-3 = proxy
config-type = --gen-config-def
--comp-name-2 = pubsub
--comp-name-1 = muc
--cluster-mode = true
--sm-plugins = +message-archive-xep-0136,+jabber:iq:auth,+urn:ietf:params:xml:ns:xmpp-sasl,+urn:ietf:params:xml:ns:xmpp-bind,+urn:ietf:params:xml:ns:xmpp-session,+jabber:iq:register,+jabber:iq:roster,+presence,+jabber:iq:privacy,+jabber:iq:version,+http://jabber.org/protocol/stats,+starttls,+msgoffline,+vcard-temp,+http://jabber.org/protocol/commands,+jabber:iq:private,+urn:xmpp:ping,+basic-filter,+domain-filter,+pep,-zlib
--debug = server,xmpp.impl,db,cluster,muc,component
#--comp-class-1 = tigase.muc.cluster.MUCComponentClustered
--comp-class-1 = tigase.muc.MUCComponent
muc/muc-lock-new-room[B]=false
--external = muc.im.test.com:muc-pass:connect:5270:devel.tigase.org:accept
--comp-class-2 = tigase.pubsub.cluster.PubSubComponentClustered
--comp-class-3 = tigase.socks5.Socks5ProxyComponent
--comp-class-4 = tigase.stun.StunComponent
--comp-class-5 = tigase.http.rest.RestMessageReceiver
--comp-class-6 = tigase.archive.MessageArchiveComponent
message-archive/archive-repo-uri=jdbc:mysql://localhost:3306/tigasedb?user=root&password=root&useUnicode=true&characterEncoding=UTF-8&autoCreateUser=true
sess-man/plugins-conf/message-archive-xep-0136/component-jid=message-archive@im.test.com
sess-man/plugins-conf/message-archive-xep-0136/auto=true
#sess-man/plugins-conf/message-archive-xep-0136/default-store-method=body
#sess-man/plugins-conf/message-archive-xep-0136/required-store-method=body

my client code is :

public void registration(final String username,final String password,final String email) throws JaxmppException{

        final Jaxmpp jaxmpp = new Jaxmpp();
        jaxmpp.getProperties().setUserProperty(SessionObject.DOMAIN_NAME, "im.test.com");

        jaxmpp.getModulesManager().register(new InBandRegistrationModule());
        jaxmpp.getSessionObject().setProperty(InBandRegistrationModule.IN_BAND_REGISTRATION_MODE_KEY, Boolean.TRUE);

        jaxmpp.getEventBus().addHandler(
                    InBandRegistrationModule.ReceivedRequestedFieldsHandler.ReceivedRequestedFieldsEvent.class,
                    new InBandRegistrationModule.ReceivedRequestedFieldsHandler() {

                        @Override
                        public void onReceivedRequestedFields(SessionObject sessionObject, IQ responseStanza) {

                            try {
                                jaxmpp.getModule(InBandRegistrationModule.class).register(username, password, email,
                                        new AsyncCallback() {

                                    @Override
                                    public void onError(Stanza responseStanza, ErrorCondition error) throws JaxmppException {
                                        System.out.println("Account registration error: " + error);
                                    }

                                    @Override
                                    public void onSuccess(Stanza responseStanza) throws JaxmppException {
                                        System.out.println("registrationSuccess");
                                    }

                                    @Override
                                    public void onTimeout() throws JaxmppException {
                                        System.out.println("Account registration failed.");
                                    }
                                });
                            } catch (JaxmppException e) {
                                System.out.println(e);
                            }

                        }

                    });
         jaxmpp.login(true);
    }

The console is:

2015-3-15 17:46:50 tigase.jaxmpp.j2se.Jaxmpp createConnector
信息: Using SocketConnector
2015-3-15 17:46:50 tigase.jaxmpp.j2se.connectors.socket.SocketConnector createSessionLogic
信息: Using XEP-0077 mode!!!!
2015-3-15 17:46:50 tigase.jaxmpp.j2se.connectors.socket.SocketConnector start
信息: Resolving SRV recrd of domain 'im.test.com'
2015-3-15 17:46:50 tigase.jaxmpp.j2se.connectors.socket.SocketConnector start
信息: Opening connection to im.test.com/127.0.0.1:5222
2015-3-15 17:46:51 tigase.jaxmpp.j2se.connectors.socket.SocketConnector$3 handshakeCompleted
信息: TLS completed javax.net.ssl.HandshakeCompletedEvent[source=1e152c5[SSL_RSA_WITH_RC4_128_MD5: Socket[addr=im.test.com/127.0.0.1,port=5222,localport=59522]]]
2015-3-15 17:46:51 tigase.jaxmpp.j2se.connectors.socket.SocketConnector proceedTLS
严重: Can't establish encrypted connection
javax.net.ssl.SSLHandshakeException: Cerificate hostname doesn't match domain name you want to connect.
    at tigase.jaxmpp.j2se.connectors.socket.SocketConnector.proceedTLS(SocketConnector.java:469)
    at tigase.jaxmpp.j2se.connectors.socket.SocketConnector.onTLSStanza(SocketConnector.java:390)
    at tigase.jaxmpp.j2se.connectors.socket.SocketConnector.processElement(SocketConnector.java:566)
    at tigase.jaxmpp.j2se.connectors.socket.SocketConnector$5.processElement(SocketConnector.java:765)
    at tigase.jaxmpp.j2se.connectors.socket.Worker$1.nextElement(Worker.java:49)
    at tigase.jaxmpp.j2se.connectors.socket.XMPPDomBuilderHandler.endElement(XMPPDomBuilderHandler.java:152)
    at tigase.xml.SimpleParser.parse(SimpleParser.java:323)
    at tigase.jaxmpp.j2se.connectors.socket.Worker.run(Worker.java:101)

The XMPP SERVER console is:

**MR-OUT**: from=null, to=null, DATA=<iq type="set" id="c2s--c2s3" to="sess-man@ja6e5njdvi8v4l0" from="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794"><command xmlns="http://jabber.org/protocol/commands" node="STREAM_OPENED"><x xmlns="jabber:x:data" type="submit"><field var="session-id"><value>01b24814-776b-4aa9-b0ae-62fe85dfb465</value></field><field var="hostname"><value>im.test.com</value></field><field var="xml:lang"><value>en</value></field></x></command></iq>, SIZE=436, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=set
**MR-IN**: from=null, to=null, DATA=<iq type="set" id="c2s--c2s3" to="sess-man@ja6e5njdvi8v4l0" from="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794"><command xmlns="http://jabber.org/protocol/commands" node="STREAM_OPENED"><x xmlns="jabber:x:data" type="submit"><field var="session-id"><value>01b24814-776b-4aa9-b0ae-62fe85dfb465</value></field><field var="hostname"><value>im.test.com</value></field><field var="xml:lang"><value>en</value></field></x></command></iq>, SIZE=436, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=set
**MR-IN**: from=null, to=null, DATA=<iq type="set" id="c2s--c2s3" to="sess-man@ja6e5njdvi8v4l0" from="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794"><command xmlns="http://jabber.org/protocol/commands" node="STREAM_OPENED"><x xmlns="jabber:x:data" type="submit"><field var="session-id"><value>01b24814-776b-4aa9-b0ae-62fe85dfb465</value></field><field var="hostname"><value>im.test.com</value></field><field var="xml:lang"><value>en</value></field></x></command></iq>, SIZE=436, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=set
**MR-OUT**: from=sess-man@ja6e5njdvi8v4l0, to=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, DATA=<iq type="result" id="c2s--c2s3" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"/>, SIZE=122, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=result
**MR-IN**: from=sess-man@ja6e5njdvi8v4l0, to=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, DATA=<iq type="result" id="c2s--c2s3" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"/>, SIZE=122, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=result
**MR-OUT**: from=null, to=null, DATA=<iq type="get" id="d5f96556-223a-4b20-82e6-527ce5c7ecc6" to="sess-man@ja6e5njdvi8v4l0" from="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794"><command xmlns="http://jabber.org/protocol/commands" node="GETFEATURES"/></iq>, SIZE=223, XMLNS=null, PRIORITY=HIGH, PERMISSION=NONE, TYPE=get
**MR-IN**: from=null, to=null, DATA=<iq type="get" id="d5f96556-223a-4b20-82e6-527ce5c7ecc6" to="sess-man@ja6e5njdvi8v4l0" from="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794"><command xmlns="http://jabber.org/protocol/commands" node="GETFEATURES"/></iq>, SIZE=223, XMLNS=null, PRIORITY=HIGH, PERMISSION=NONE, TYPE=get
**MR-IN**: from=null, to=null, DATA=<iq type="get" id="d5f96556-223a-4b20-82e6-527ce5c7ecc6" to="sess-man@ja6e5njdvi8v4l0" from="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794"><command xmlns="http://jabber.org/protocol/commands" node="GETFEATURES"/></iq>, SIZE=223, XMLNS=null, PRIORITY=HIGH, PERMISSION=NONE, TYPE=get
**MR-OUT**: from=sess-man@ja6e5njdvi8v4l0, to=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, DATA=<iq type="result" id="d5f96556-223a-4b20-82e6-527ce5c7ecc6" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"><command xmlns="http://jabber.org/protocol/commands" node="GETFEATURES"><ver xmlns="urn:xmpp:features:rosterver"/><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism></mechanisms><register xmlns="http://jabber.org/features/iq-register"/><auth xmlns="http://jabber.org/features/iq-auth"/></command></iq>, SIZE=562, XMLNS=null, PRIORITY=NORMAL, PERMISSION=NONE, TYPE=result
**MR-IN**: from=sess-man@ja6e5njdvi8v4l0, to=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, DATA=<iq type="result" id="d5f96556-223a-4b20-82e6-527ce5c7ecc6" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"><command xmlns="http://jabber.org/protocol/commands" node="GETFEATURES"><ver xmlns="urn:xmpp:features:rosterver"/><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism></mechanisms><register xmlns="http://jabber.org/features/iq-register"/><auth xmlns="http://jabber.org/features/iq-auth"/></command></iq>, SIZE=562, XMLNS=null, PRIORITY=NORMAL, PERMISSION=NONE, TYPE=result
**MR-IN**: from=sess-man@ja6e5njdvi8v4l0, to=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, DATA=<iq type="result" id="d5f96556-223a-4b20-82e6-527ce5c7ecc6" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"><command xmlns="http://jabber.org/protocol/commands" node="GETFEATURES"><ver xmlns="urn:xmpp:features:rosterver"/><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism></mechanisms><register xmlns="http://jabber.org/features/iq-register"/><auth xmlns="http://jabber.org/features/iq-auth"/></command></iq>, SIZE=562, XMLNS=null, PRIORITY=NORMAL, PERMISSION=NONE, TYPE=result
**MR-OUT**: from=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, to=sess-man@ja6e5njdvi8v4l0, DATA=<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>, SIZE=51, XMLNS=urn:ietf:params:xml:ns:xmpp-tls, PRIORITY=NORMAL, PERMISSION=NONE, TYPE=null
**MR-IN**: from=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, to=sess-man@ja6e5njdvi8v4l0, DATA=<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>, SIZE=51, XMLNS=urn:ietf:params:xml:ns:xmpp-tls, PRIORITY=NORMAL, PERMISSION=NONE, TYPE=null
**MR-IN**: from=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, to=sess-man@ja6e5njdvi8v4l0, DATA=<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>, SIZE=51, XMLNS=urn:ietf:params:xml:ns:xmpp-tls, PRIORITY=NORMAL, PERMISSION=NONE, TYPE=null
**MR-OUT**: from=sess-man@ja6e5njdvi8v4l0, to=null, DATA=<iq type="set" id="tig1" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"><command xmlns="http://jabber.org/protocol/commands" node="STARTTLS"><x xmlns="jabber:x:data" type="submit"/><proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/></command></iq>, SIZE=287, XMLNS=null, PRIORITY=NORMAL, PERMISSION=LOCAL, TYPE=set
**MR-IN**: from=sess-man@ja6e5njdvi8v4l0, to=null, DATA=<iq type="set" id="tig1" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"><command xmlns="http://jabber.org/protocol/commands" node="STARTTLS"><x xmlns="jabber:x:data" type="submit"/><proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/></command></iq>, SIZE=287, XMLNS=null, PRIORITY=NORMAL, PERMISSION=LOCAL, TYPE=set
**MR-IN**: from=sess-man@ja6e5njdvi8v4l0, to=null, DATA=<iq type="set" id="tig1" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"><command xmlns="http://jabber.org/protocol/commands" node="STARTTLS"><x xmlns="jabber:x:data" type="submit"/><proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/></command></iq>, SIZE=287, XMLNS=null, PRIORITY=NORMAL, PERMISSION=LOCAL, TYPE=set
**MR-OUT**: from=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, to=sess-man@ja6e5njdvi8v4l0, DATA=<iq type="set" id="21060c8d-6e99-450f-a05c-fd46ea9fac3e" to="sess-man@ja6e5njdvi8v4l0" from="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794"><command xmlns="http://jabber.org/protocol/commands" node="STREAM_CLOSED"/></iq>, SIZE=225, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=set
**MR-IN**: from=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, to=sess-man@ja6e5njdvi8v4l0, DATA=<iq type="set" id="21060c8d-6e99-450f-a05c-fd46ea9fac3e" to="sess-man@ja6e5njdvi8v4l0" from="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794"><command xmlns="http://jabber.org/protocol/commands" node="STREAM_CLOSED"/></iq>, SIZE=225, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=set
**MR-IN**: from=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, to=sess-man@ja6e5njdvi8v4l0, DATA=<iq type="set" id="21060c8d-6e99-450f-a05c-fd46ea9fac3e" to="sess-man@ja6e5njdvi8v4l0" from="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794"><command xmlns="http://jabber.org/protocol/commands" node="STREAM_CLOSED"/></iq>, SIZE=225, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=set
**MR-OUT**: from=sess-man@ja6e5njdvi8v4l0, to=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, DATA=<iq type="result" id="21060c8d-6e99-450f-a05c-fd46ea9fac3e" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"/>, SIZE=149, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=result
**MR-IN**: from=sess-man@ja6e5njdvi8v4l0, to=c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794, DATA=<iq type="result" id="21060c8d-6e99-450f-a05c-fd46ea9fac3e" to="c2s@ja6e5njdvi8v4l0/127.0.0.1_5222_127.0.0.1_49794" from="sess-man@ja6e5njdvi8v4l0"/>, SIZE=149, XMLNS=null, PRIORITY=SYSTEM, PERMISSION=NONE, TYPE=result

please help me to resolve,thanks.


Replies (1)

Added by Wojciech Kapcia TigaseTeam almost 4 years ago

As the error suggests:

 Can't establish encrypted connection
javax.net.ssl.SSLHandshakeException: Cerificate hostname doesn't match domain name you want to connect.

certificate you're using on the server is wrong and causes connection to drop - i.e. CN name in the certificate name doesn't match SessionObject.DOMAIN_NAME, "im.test.com"

    (1-1/1)