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.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by bettyl]

Is there any update to the source code posted on this website ?

I tried out the code for chapter 4 on windows NT and got a nullpointer
exception on the server side(see below). The client was hanging on waiting for
message.

09:07:13:406 QueueThread: java.lang.NullPointerException
09:07:13:406 QueueThread: at com.metamech.vorpal.DeliveryHandler.notify(De
liveryHandler.java:42)
import-bot (20211) [Avatar] Offline
#2
Re: Running sample code
[Originally posted by iainshigeoka]

Hi Beth,

> Is there any update to the source code posted on this website ?

Not yet... smilie

Could you send a full stack trace (or even better, a full copy of the console
window up to, and including the stack trace)? I haven't seen this before but
have some sneaking suspicions where the problem may lie.

-iain

> I tried out the code for chapter 4 on windows NT and got a nullpointer
> exception on the server side(see below). The client was hanging on
waiting for
> message.
>
> 09:07:13:406 QueueThread: java.lang.NullPointerException
> 09:07:13:406 QueueThread: at
com.metamech.vorpal.DeliveryHandler.notify(De
> liveryHandler.java:42)
import-bot (20211) [Avatar] Offline
#3
Re: Running sample code
[Originally posted by bettyl]

Here is the server console output

Jabber Server -- localhost:5222
10:34:33:843 [XS] URI: http://etherx.jabber.org/streams lName: stream qName: str
eam:stream
10:34:33:843 [PQ] <stream:stream from='angel@localhost' to='localhost'/>
10:34:33:859 QueueThread: java.lang.NullPointerException
10:34:33:859 QueueThread: at com.metamech.vorpal.DeliveryHandler.notify(De
liveryHandler.java:42)
10:34:33:859 QueueThread: at com.metamech.jabber.xml.QueueThread.run(Queue
Thread.java:55)
10:34:33:859 [XS] URI: http://etherx.jabber.org/streams lName: stream qName: str
eam:stream
10:34:33:859 [PQ] <stream:stream from='buffy@localhost' to='localhost'/>
10:34:33:859 [XC]
10:34:33:859 [XS] URI: jabber:client lName: message qName: message
10:34:33:859 QueueThread: java.lang.NullPointerException
10:34:33:859 10:34:33:859 QueueThread: at com.metamech.vorpal.DeliveryHandler.n
otify(DeliveryHandler.java:42)
10:34:33:859 QueueThread: at com.metamech.jabber.xml.QueueThread.run(Queue
Thread.java:55)
[XC]
10:34:33:859 [XS] URI: jabber:client lName: subject qName: subject
10:34:33:859 [XC] Want to patrol?
10:34:33:875 [XE] finished with subject
10:34:33:875 [XC]
10:34:33:875 [XS] URI: jabber:client lName: thread qName: thread
10:34:33:875 [XC] thread_id
10:34:33:875 [XE] finished with thread
10:34:33:875 [XC]
10:34:33:875 [XS] URI: jabber:client lName: body qName: body
10:34:33:890 [XC] Hey, wondered if you wanted to patrol with me tonight?
10:34:33:890 [XE] finished with body
10:34:33:890 [XC]
10:34:33:890 [XE] finished with message
10:34:33:890 [PQ] <message type='normal' to='angel@localhost' id='msg_id_buffy'>
<subject> Want to patrol?</subject> <thread> thread_id</thread> <body> He
y, wondered if you wanted to patrol with me tonight?</body> </message>
10:34:33:890 QueueThread: java.lang.NullPointerException
10:34:33:890 QueueThread: at com.metamech.jabber.xml.QueueThread.run(Queue
Thread.java:45)
import-bot (20211) [Avatar] Offline
#4
Re: Running sample code
[Originally posted by iainshigeoka]

Hello,

I think I've fixed the problem. You can download it from a temporary page
I've set up and give it a try:

http://www.messaginglogic.com/imj
Otherwise, you can wait until tomorrow when the Manning webmaster will be
uploading a copy to the book's normal web page. Let me know if there are
still problems.

-iain
import-bot (20211) [Avatar] Offline
#5
Re: Running sample code
[Originally posted by bettyl]

> Hello,
>
> I think I've fixed the problem. You can download it from a temporary page
> I've set up and give it a try:
>
> http://www.messaginglogic.com/imj
> Otherwise, you can wait until tomorrow when the Manning webmaster will be
> uploading a copy to the book's normal web page. Let me know if there are
> still problems.
>
> -iain

Thanks. I downloaded the source from the temporary page. Should the file name
be jim_02-03-14.zip ? Just want to double check that it is the latest source.

I also found out that the nullpointer exception went away when I ran from the
respective jar files. But the client still blocked. Looks like there is a
problem of getting the message from the server to the client.
import-bot (20211) [Avatar] Offline
#6
Re: Running sample code
[Originally posted by iainshigeoka]

> Thanks. I downloaded the source from the temporary page. Should the file
name
> be jim_02-03-14.zip ? Just want to double check that it is the latest
source.

Yup. The manning book site has also been updated.

> I also found out that the nullpointer exception went away when I ran from
the
> respective jar files. But the client still blocked. Looks like there is a
> problem of getting the message from the server to the client.

smilie Yeah. I'm embarassed to say that my first implementation relied on the
ordering of iteration from the hashtable. This of course is not a given so I
think the behavior is different on Mac OS X (what I'm on) and Windows which
is what it looks like you are on. Java is crossplatform as long as I don't
rely
on platform specific behavior! smilie

Anyhow, the update not only hopefully eliminates the chance for the null
pointer exception, but also makes sure that the QueueThread acts as it
should no matter what platform you're on. Please give it a try and see if it
works better for you.

-iain

ps - this is only an issue on the chp4 code because we don't have enough of
the server protocols in place at this stage. Future chapters are a bit more
robust. smilie