This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

NoClassDefFoundError in HF EJB Chapter 1

 
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
 
Rancher
Posts: 43016
76
  • 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
 
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.
 
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.
https://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
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic