Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Unhandled exception type XmppStringprepException

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 586
    Answer it
    import org.jivesoftware.smack.tcp.XMPPTCPConnection;
    import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
    import org.jxmpp.jid.DomainBareJid;
    import org.jxmpp.jid.EntityBareJid;
    import org.jxmpp.jid.Jid;
    import org.jxmpp.jid.impl.JidCreate;
    import org.jxmpp.jid.util.JidUtil;
    import org.jxmpp.stringprep.XmppStringprepException;
    
    public class chat_try {
    public static void main(String args[]) 
    {
    
    //DomainBareJid serviceName = JidCreate.bareFrom("test3@192.168.0.103");
    //Jid jid= JidCreate.from("test3@192.168.0.103");
    //Jid myJid = Jid("","",""); 
    //Jid jid= JidCreate.from("xxxxx@winiqo.com");
    String var = "sonic@nobody.com";
    EntityBareJid jid = JidCreate.entityBareFrom(var);
    
    XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
            .setUsernameAndPassword("test3", "elkill")
            //.setXmppDomain(serviceName)
            .setHost("192.168.0.103")
            .setPort(5222)
            .setDebuggerEnabled(true) // to view what's happening in detail
            .build();
    
    XMPPTCPConnection conn1 = new XMPPTCPConnection(config);
    try {
        conn1.connect();
        if(conn1.isConnected()) {
            System.out.println("isConnected");
        }
        conn1.login();
    
        if(conn1.isAuthenticated()) {
             System.out.println("isAuthenticated");
        }
    }
    catch (Exception e) {
         System.out.println(e.toString());
    }
    
    }}

    This is my code for a simple XMPP user connection configuration using "smack" library.It requires a "XMPPDomain" to work. There's a ".setXmppDomain()" method for setting the domain, it takes a "DomainBareJid" as an argument, my attempts to convert a string to DomainBareJid using all the above libraries are resolving to the same error, "Unhandled exception type XmppStringprepException", help!

    Sorry if it's a bad doubt, I'am new to Java coding.:)

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: