The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Farsen (1) [Avatar] Offline

I dont think anybody will answer this, since the last post is from july last year! But´I´ll give it a try anyways.

Ive set up Eclipse to run with junit, xerces an ant. And it works fine.
I compile and run the server in chapter 8. Then i open up a telnet connction (putty), start the stream, register a new user, auth with the new user, and set my presence to available. I do this whith two different users/connections, and it works fine with the server.
But when i try to send a message between the 2 users, it gives me this error on the server console:

15:29:57:415 [PQ] <message from='' to=''> <subject> Hello there</subject> <body> You there?</body> </message>
15:29:57:415 QueueThread: java.lang.NullPointerException

15:29:57:415 QueueThread: at com.metamech.vorpal.MessageHandler.notify(

15:29:57:415 QueueThread: at

On line 48 in the messagehandler, it says:
if (packet.getAttribute("type").equals("groupchat")){

And line 63 in the queuethread it just says:

I aint no expert in java, but i really cant figure out what the problem is...

Hope someone sees this and cant figure it out..
Thanks smilie
PoLe (3) [Avatar] Offline
Re: Chp8 server MessageHandler problem

You have been lucky, There is still someone who is looking at this forums!

I'm developing a jabber server as my software engineering project and i'm using shigeoka's book as reference.

Anyway, the problem is that you are trying to access to a null object. Why? because if you send normal messages (without the groupchat tag) you get a null object and the program crashes. To fix it just do some basic error checking:

packet.setFrom(packet.getSession().getJID().toString()); //anti-spoofing
String attribute = packet.getAttribute("type");
if (attribute != null && attribute.equals("groupchat")){ //error checking

I hope it helps, have a good day,