Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError in HF EJB Chapter 1

 
T Lin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am new in this forum and new to SCBCD. I bought a HF EJB book and followed the example of Chapter 1 Intro to EJB. After I compiled the bean src code, deployed in J2EE server, compiled the client class and then start the client. I got a NoClassDefFoundError message.

The didn't get to use the command in the book because I am running the example on a WindowsXP PC and don't know how to put {$CLASSPATH}:AdviceAppClient.jar in the command line. So I only use

java AdviceClient

I guess the purpose of {$CLASSPATH}:AdviceAppClient.jar is to add AdviceAppClient.jar to CLASSPATH env variable, so I set the CLASSPATH with AdviceAppClient.jar before compiling and running the client code. But I still get the error.

Could anybody who has more experience please help me out?

Thanks
T Lin
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Instead of setting CLASSPATH, try specifying it when running the program. Its would like:

java -classpath AdviceAppClient.jar AdviceClient

This assumes that the jar file is in the directory you're currently in. If it is somewhere else, specify the full path:

java -classpath C:\hfejb\AdviceAppClient.jar AdviceClient
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're getting NoClassDefFoundError message for which class?
Have you included the current directory (".") in your classpath?

You can set env variable like this
c:\>set CLASSPATH="c:\j2sdkee1.3.1\lib\j2ee.jar;.;myAppClient.jar"

You can check what have been set in the CLASSPATH environment variable by follwing command
c:\>set class

Check and reply with more info if you need.
 
MI Mohammed
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lin,
Check this thread, alot was discussed about this application. I think it should solve the problem.
http://www.coderanch.com/t/161481/java-EJB-SCBCD/certification/AdviceClient-Solution

Thanks
 
T Lin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf Dittmer, Ankit Doshi, mi Mohammed, I followed your suggestion and problem solved
T Lin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic