AccountManager.changePassword() throws XMPPException

Hi,

I’'m trying to change my password on a Jabber server (1.4.2a) with this code:

XMPPConnection connection = new XMPPConneconnection(“localhost”, 5222);

connection.login(“testuser”, “oldpw”);

AccountManager accManager = new AccountManager(connection);

accManager.changePassword(“newpw”);

but I get an XMPPException after changePassword().

This is smack-1.0-beta3 on Linux.

Any ideas?

Thanks,

Ati.

Post the stack trace that you’'re getting from the exception. Also, it would help if you could paste in the XML with Smack debugging on.

-iain

JabberControl.changePassword(): org.jivesoftware.smack.XMPPException

(503) Service Unavailable – org.jivesoftware.smack.XMPPException at org.jivesoftware.smack.AccountManager.changePassword(AccountManager.java:217)

at com.sis.ngms.JabberControl.changePassword(JabberControl.java:101)

at com.sis.ngms.AccountList.updateAccount(AccountList.java:123)

How can I switch on the debug mode in a WWW application?

The exception tells you what the problem is, I believe – your server doesn’'t support changing passwords.

Regards,

Matt

I tried to change my password in the XML console of a Jabber client (psi) and it was successful (although I had to restart the jabberd because it didn’'t forget my old password).

Sorry, I forgot it but the library I used previously (Echomine Muse) also could change my password.

Ati.

Ati,

In that case, we’‘ll need to know what the difference in XML commands is. You said you’'re using the API as part of JSP or a website? In that case, you may wish to make a separate command-line app so that you can use the debug tool and then send us the XML you see.

Thanks,

Matt

I have created a command-line application and I tried it with XMPPConnection.DEBUG_ENABLED = true and -Dsmack.debugEnabled=true but I see no debug window just the Exception I mentioned before.

What do I do wrong?

Thanks,

Ati.

Here’'s some sample code that you can try. You should see the debug window when you run it:

import org.jivesoftware.smack.*; public class MainTest {     public static void main(String [] args) throws Exception {
        XMPPConnection.DEBUG_ENABLED = true;         XMPPConnection con = new XMPPConnection("blah.com");
        con.login("test1", "test1");
    }
}

Regards,

Matt

Thank you for the code sample. Here is the debug info:

Client:

<stream:stream to=“jessica” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams”>

proba

probaa2a11524599132366686bd 99bc9784ab8da844d9Smack

probanewproba</passwo rd>

Server:

<?xml version=''1.0''?>

<iq id=’‘2SDuR0’’ type=’‘result’’><query xmlns=’‘jabber:iq:auth’’>proba

4973E709448

<iq id=’‘2SDuR2’’ type=’‘result’’/>

<presence xmlns=’‘jabber:client’’ id=’‘id_10313’’ from=’‘proba@jessica/Home’’ to=’‘proba@jessica’’><priority xmlns=’‘jabber:client’’>1<status xmlns=’‘jabber:client’’>

Online<x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T18:59:52’’/><x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T18:59:52’’/><x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T18:59:57’’/>

<x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T19:43:15’’/><x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T19:44:16’’/><x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T19:46:56’’/>

<x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T19:49:26’’/><x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T19:49:48’’/><x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T19:50:33’’/>

<x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T19:52:05’’/><x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T19:52:26’’/><x xmlns=’‘jabber:x:delay’’ from=’‘proba@jessica/Home’’ stamp=’‘20030313T20:29:37’’/>

<iq id=’‘2SDuR6’’ type=’‘result’’ from=’‘proba@jessica/Smack’’><query xmlns=’‘jabber:iq:roster’’/><iq id=’‘2SDuR7’’ type=’‘error’’ from=’‘proba@jessica’’ to=’‘proba@jessica/Smack’’><query xmlns=’‘jabber:iq:register’’>proba

newproba<error code=’‘503’’>Service Unavailable

Interpreted packets:

proba</ iq>

Online1</presen ce>

probanewproba</passwo rd>503Service Unavailable

I hope this helps.

Thanks,

Ati.

So, Smack sent:

probanewproba</passwo rd>

And the server replied:

<iq id=’‘2SDuR7’’ type=’‘error’’ from=’‘proba@jessica’’ to=’‘proba@jessica/Smack’’><query xmlns=’‘jabber:iq:register’’>proba

newproba<error code=’‘503’’>Service Unavailable

I don’‘t see anything wrong with the XML we sent. What is the XML you’'ve used in the past that worked?

Regards,

Matt

I tried this after I connected to the server:

<iq type=’‘set’’ to=’‘jessica’’>

<query xmlns=’‘jabber:iq:register’’>

proba

newpassword

and it worked for me.

Ati.

The only difference I see is that the “to” field is set in your custom query and Smack doesn’‘t. Can you test without the to field and see if that still works and to confirm the issue? In any case, I just took a look at the example registration XML at jabber.org and it always includes a to field. So, I’'ll adjust the Smack code to do this too.

Thanks,

Matt

I just finished the test with Psi’'s XML console. Here is the result of the test without ‘‘to’’ field:

Jabber: wrote: [

<iq type=’‘set’’>

<query xmlns=’‘jabber:iq:register’’>

sragli

proba

]

JabIO: incoming: [

sragli

proba

Service Unavailable

]

and with ‘‘to’’ field:

Jabber: wrote: [

<iq type=’‘set’’ to=’‘jessica’’>

<query xmlns=’‘jabber:iq:register’’>

sragli

proba

]

JabIO: incoming: [

]

I dont’'t know what makes the difference but the Admin FAQ at http://www.jabber.org/admin/adminfaq.html#id2780880 mentioned the same example what I tried (with the ‘‘to field’’).

Regards,

Ati.