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 iamstyles]

Iain:

I've been away from coding but i'm back at things again.

I really want to get my server to build, but I think I've stumbled on the
xerces problem that is mentioned but actually not really described in detail
in the forum. I have put the junit.jar, ant.jar, optional.jar, and xerces.jar
into my classpath plus a couple of regular java .jar files. I am using the
java sdk for 1.4.0, I understand that things can happen with my classpath but
I don't know why. I have updated my build.xml files with the classpath change
as indicated in a few of the other messages.

I get this single error, I type just "ant" at the chp3 directory level. Is
this right, or should I ant something else?

[javac] D:ApacheTomcatwebappsorach5jim_srcchp3srccommetamechjabbe
rxmlJabberInputHandler.java:60: cannot resolve symbol
[javac] symbol : method setReaderFactory (com.metamech.jabber.xml.Streamin
gCharFactory)
[javac] location: class org.apache.xerces.parsers.SAXParser
[javac] parser.setReaderFactory(new StreamingCharFactory());
[javac] ^
[javac] 1 error

I think that I need to do the build successfully, then later I would do a
variant of java -cp (classpath stuff) Server.java to get the server up and
running (is this right?)

I also have downloaded the Smack package from jivesoftware.com. I haven't
unzipped yet, but is this only for the client side of things? I am assuming
that I still need to get the server up and going first before maybe moving the
client over to Smack.

Thanks,

J!
import-bot (20211) [Avatar] Offline
#2
Re: xerces and smack
[Originally posted by iain.shigeoka]

> I really want to get my server to build, but I think I've stumbled on the
> xerces problem that is mentioned but actually not really described in detail

[snip]

> I get this single error, I type just "ant" at the chp3 directory level. Is
> this right, or should I ant something else?

that's right.

> [javac] D:ApacheTomcatwebappsorach5jim_srcchp3srccommetamechjabbe
> rxmlJabberInputHandler.java:60: cannot resolve symbol
> [javac] symbol : method setReaderFactory
(com.metamech.jabber.xml.Streamin

Yup. You have a classpath issue. There is a copy of Xerces on your classpath
before the copy that came with the book source. If you installed Ant normally,
then Ant is the culprit as it ships with with it's own copy of Xerces which is
overriding the one from the book. The most recent thread in this forum on
classpath issues includes information on how to get around this problem.

> I think that I need to do the build successfully, then later I would do a
> variant of java -cp (classpath stuff) Server.java to get the server up and
> running (is this right?)

Yes. That's correct.

> I also have downloaded the Smack package from jivesoftware.com. I haven't
> unzipped yet, but is this only for the client side of things? I am assuming

Yes. Smack is a client-side library.

> that I still need to get the server up and going first before maybe moving the
> client over to Smack.

A lot depends on what you're doing. If you are only developing on the client
side (which is usually the case) then you just need to run any XMPP/Jabber
server to run/test against. I'm biased towards Jive Software Messenger:

http://www.jivesoftware.com/products/messenger

Which is commercial but is available as a 10 session free version which is
perfect for testing against or using with small workgroups. You can get a
complete list of known XMPP servers at http://www.jabber.org

-iain
import-bot (20211) [Avatar] Offline
#3
Re: xerces and smack
[Originally posted by iamstyles]

Iain:

I've hobbled along, and I've been successful with getting both the server and
the client up from the book. I had a good weekend. smilie

I am going to be working on customizing and increasing the performance for an
application that I am working on. Generally I am going to get rid of the XML
parser and replace it with some very simple string formats since I only care
about single user messaging and nothing else, scalability is important to me.

I want to put the client into an applet. Any suggestions? And also is there
any source code for GUIs that run on top of Jabber clients? I already have a
fair bit of swing done for my GUI and I think it's probably just a simple
handoff of messages to and from inputs / windows to the client.

I am trying to build smack. The problem i'm getting is that apparently my
Target of "ant-contrib.jar" does not exist in the project. I think this might
have something to do with the build.xml file but are there any dependancies on
classpath in smack for the build?

Thanks again for your help,

J!