Creating New user in XMPP server using Java -


i trying create new user in xmpp using java getting null pointer exception. can body me this.

i have tried

            this.connectionconfiguration connconfig = new              connectionconfiguration("serverip", 5222);             xmppconnection connection = new xmppconnection(connconfig);             connection.login("admin@target.com", "kjbkishan");             connection.connect();              accountmanager accountmanager = connection.getaccountmanager();             map<string, string> attributes = new hashmap<string, string>();             attributes.put("username", "krishna");             attributes.put("password", "123456");             attributes.put("email", "krishna@gmail.com");             attributes.put("name", "krishnathakkar");              accountmanager.createaccount("krishna@target.local", "123456",attributes);              registration registration = new registration();             registration.settype(iq.type.set);             registration.setto(connection.getservicename());              packetfilter filter = new andfilter(new packetidfilter(registration.getpacketid()), new packettypefilter(iq.class));             packetcollector collector = connection.createpacketcollector(filter);             connection.sendpacket(registration);              connection.connect(); 

any appreciated.

stacktrace

java.lang.illegalstateexception: not connected server.     @ org.jivesoftware.smack.xmppconnection.login(xmppconnection.java:382)     @ org.jivesoftware.smack.xmppconnection.login(xmppconnection.java:349)     @ com.verve.xmppuser.usercreating.commectxmpp(usercreating.java:37)     @ com.verve.xmppuser.usercreating.main(usercreating.java:27 

well here simple answer.

            connectionconfiguration connconfig = new connectionconfiguration("ip", 5222);             xmppconnection connection = new xmppconnection(connconfig);              connection.connect();             connection.login("username", "password");             accountmanager accountmanager = connection.getaccountmanager();             accountmanager.createaccount("admincreated1", "123456");             connection.disconnect(); 

its done.. :d


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -