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.

kisner_jh (5) [Avatar] Offline
Right now i'm just trying to get the server built in chapter 3 to run so I can telnet into it...

The build process went smoothly with no errors. I made a batch file with the command:
@echo off
java -cp jabber.jar;server.jar;libxerces.jar com.metamech.vorpal.Server

The server initalized as expected "Jabber Server --"

The problem began when i tried to telnet into it.
The other cmd prompt appeared to have connected to it. However nothing was printed on the prompt. Not sure if the server was supposed to say "welcome" or anything (haven't dove too far in the code, just changed the server name). Or maybe I just have echo off.

Anyway, my question is that when I telnet into the server, as soon as I connect, the server prompt throws this error: java.lang.NoClassDefFoundError: org/apache/xerces/readers/XMLEntityReaderFactory at

The server does not halt, as it allows for other connections, but still throws that error.

I'm assuming this is something to do with xerces that I didn't do correctly... Any help is appreciated

Background info:
Windows Server 2003
xerces.jar and other files from your second zip file placed in antlib
iain (56) [Avatar] Offline
Re: Questions about server
It's a classpath issue. You need to run the server with the same xerces jar you used to compile against (since that's obviously working). I suspect your normal java.exe classpath includes a different xerces.jar.

kisner_jh (5) [Avatar] Offline
Re: Questions about server
I'm sorry Iain, i'm not gonna lie to ya...I'm new to ant,junit, and true developing. All I've ever done is write code.

How would you go about doing that? I've tried putting the xerces.jar in the j2sdk1.4.2_05lib directory...and in chp3inlibxerces.jar. Still same error.

It's a wonder that I even got ant to work though. smilie
iain (56) [Avatar] Offline
Re: Questions about server
The easiest method is to build everything up on the command line (using a batch file so you don't have to keep typing it in). The jdk should have come with a pretty detailed set of documentation about how to launch java.exe (specifically the -classpath option). Basically, run java with the classpath just pointing to the xerces file, and the library you built. Make sure you don't have another xerces.jar on your classpath already (you should check what your CLASSPATH environmental variable is - I recommend keeping it empty) and if there are anything jars in your jre's lib/ext directory.

There are some java programs around that can help you check your classpath (google for 'java which' - there should be a free version somewhere). You'll end up doing a lot of classpath stuff as you deal with larger programs so it's a good investment of your time to learn.

kisner_jh (5) [Avatar] Offline
Re: Questions about server
Well I can't help but say how impressed I am that I get such good service here. I got it working thanks to you.

Stupid Question 1: Let's say I were to use your server you created in chp8 and made a client of my own using the Smack API. Do you forsee any conflicts for me to get a simple/basic messaging, presence, info/query jabber client to work using it with that particular server?

Stupid Question 2: I telnet in and i can't see what i'm typing and/or receiving. I've tried the "echo on" command but that doesn't work. I can't remember what it is, can you?

By the way, I tried out Jive Messenger. I must say that it is one of the best designed and easiest to use, soon to be open source, software i've used. Excellent work on that.

Message was edited by: kisner_jh
iain (56) [Avatar] Offline
Re: Questions about server
Thanks for the kind words.

#1 There should be no conflicts using Smack against the book server. Smack supports more advanced protocols than the book server does but as long as you stay away from those you should be fine (MUC is an example).

#2 Turning echos on in telnet depends on the telnet client. So it depends on which you're using. An easier way is to use Smack with debugging turned on (see Smack docs). This will pop open an XML log swing window which I believe now allows you to type in arbitrary XML to send. If not (I know it was a planned feature a while back) then you should try the Exodus client if you're on Windows. It also has a debug window that allows that (smack is better because it's crossplatform and in java so you can tweak to your hearts content).

I'm glad you like Messenger. Once you see the source you'll see it's basically the same design as the book server but implemented in a much more production oriented manner. Hopefully it will be pretty easy to take what you know of the book source to get familiar with what's going on in the server.