Underscores in usernames are not supported


Our Wildfire 3.0.1 installation is integrated with LDAP and we are using underscores in user names. I can see several types of exceptions being logged in the error log, one example being:

java.lang.IllegalArgumentException: Illegal JID: prefix_user1

at org.xmpp.packet.JID.init(JID.java:401)

at org.xmpp.packet.JID.(Roster.java:94)

at org.jivesoftware.wildfire.roster.RosterManager.getRoster(RosterManager.java:94)

at org.jivesoftware.wildfire.handler.IQLastActivityHandler.handleIQ(IQLastActivity Handler.java:52)

at org.jivesoftware.wildfire.handler.IQHandler.process(IQHandler.java:48)

at org.jivesoftware.wildfire.IQRouter.handle(IQRouter.java:268)

at org.jivesoftware.wildfire.IQRouter.route(IQRouter.java:96)

at org.jivesoftware.wildfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:67)

at org.jivesoftware.wildfire.net.SocketReader.processIQ(SocketReader.java:247)

at org.jivesoftware.wildfire.net.ClientSocketReader.processIQ(ClientSocketReader.j ava:51)

at org.jivesoftware.wildfire.net.SocketReader.process(SocketReader.java:213)

at org.jivesoftware.wildfire.net.BlockingReadingMode.readStream(BlockingReadingMod e.java:156)

at org.jivesoftware.wildfire.net.BlockingReadingMode.run(BlockingReadingMode.java: 62)

at org.jivesoftware.wildfire.net.SocketReader.run(SocketReader.java:123)

at java.lang.Thread.run(Unknown Source)

Caused by: org.jivesoftware.stringprep.IDNAException: Contains non-LDH characters.

at org.jivesoftware.stringprep.IDNA.toASCII(IDNA.java:106)

at org.jivesoftware.stringprep.IDNA.toASCII(IDNA.java:53)

at org.xmpp.packet.JID.init(JID.java:366)

The root cause is always the org.jivesoftware.stringprep.IDNAException with message “Contains non-LDH characters.”

Is there any chance to (optionally) allow underscores in usernames?




usernames with underscore are supported. I wonder why LDAP shoud handle the usernames different, maybe this problem exists also without LDAP while I can’'t reproduce it.


Currently running eDir LDAP, with underscores, no issues whatsoever with ‘’_’’ in the user names. I have _ and - in some too without any problems. I wonder if some other information is causing this problem you are having.

Can you create a user named “Joe_Smith” and get the same results?


Message was edited by: jeff_garner


line 366 (at org.xmpp.packet.JID.init(JID.java:366)) is the domain and not the node. So it seems that not the user but the domain is causing the problem and a domain name must not contain “_”.

So I still wonder how user@host_name.com could be added to your roster … Wildfire does not allow to add these entries. So you may want to remove them manually or ignore them.


@ in usernames should be supported in 3.1. Not quite there yet, but will be.

Thanks to everyone who replied!

I downloaded the source code and I am looking at the org.xmpp.packet.JID class. It looks like our users are adding contacts without domains since the user name ends up in the domain variable, with an underscore, which is not allowed in the domain name, so LG’'s guess is correct.

Is there any safe way to fix users’’ rosters?



Well when you say fix the user’'s rosters do you mean change the domain name. depending on the database, you could do a select replace statement. For Postgresql the statement would look something like this

SELECT REPLACE (columname, ‘‘item to be replaced’’ , ‘‘new information’’) from tablename;

live example:

SELECT REPLACE (jid, ‘’@12_34.com’’ , ‘’@1234.com’’) from jiveroster;

This would replace 12_34.com with 1234.com throughout the jid column in your DB. HOWEVER, if users have local .xml files this could be readded when they log in.


Hi Jeff,

my Wildfire version does not allow to add foo@x_x to the roster. So I wonder how one could add these.


I really have no idea how you could add these. I can use “_” in the user names but have not had an issue with it in the domain name, although I have a limited server environment. The statement I gave for Postgres above will replace the underscored information with the information provided, in reverse I am not sure that it would allow it to work in wildfire, although it would change it in the database if you supplied it. I think this is going to be a GATO question. Sorry for not being too much help.


Beleive it or not, "select * from jiveroster where jid not like ‘’%@domain.com’’ " returns about 90 rows with all kinds of misspelled/incorrect usernames, including ones without domains and with underscores in them.

Message was edited by: Zmitrok


when did you upgrade to 3.0.1and which was the version you did use before? I assume that Jive Messenger had such problems but no Wildfire version.


Yeah users can add any jid for a contact they like, doesn;t really mean that they are correct. I get those all the time and periodically go through and either change or delete them if I know what it is supposed to be or not. And yes, it does create all sorts of nifty errors in the logs for me too. That is typically when I go in and start hacking them out of the DB.


Hi LG,

It was 2.5.1.


Message was edited by: Zmitrok

Hi Jeff,

Thanks for your reply. It’'s good to know that this problem is common. I will just leave the problematic jids in the table, because it looks like some client apps maintain local copies of their rosters and re-submit them time after time.

Thanks for your help,