This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AdviceClient does not run,very dissapointing

 
Loukas G
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The AdviceClient is compiled but not executed.Everything is executed according to the Head First EJb book's first example.Windows XP - J2EE 1.3.1 RI - J2SDK 1.4.2_03 are used.When i try to run AdviceClient :
java -classpath E:\j2sdkee1.3.1\lib\j2ee.jar;E:\source\projects\advice\AdviceAppClient.jar AdviceClient
The following error is provided which is very strange:
javac -classpath E:\j2sdkee1.3.1
Exception in thread "main" java.lang.NoClassDefFoundError: AdviceClient
Here is the code:
import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import headfirst.*;
import javax.ejb.*;

public class AdviceClient
{
public static void main(String[] args)
{
new AdviceClient().go();
}
public void go() {
try
{
Context ic = new InitialContext();
Object o = ic.lookup("Advisor");
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advisor = home.create();
System.out.println(advisor.getAdvice());
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
Anyone who knows please tell me if i do something wrong or there is a bug in the RI.Thank you in advance
 
Loukas G
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, ignore the first line of the error message.
Thank you.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I suspect that this could be something to do with classpath.
Make sure the package of the AdviceClient or the classes that it uses
is in the classpath.
2. If you try posting this in the SCBCD cert forum, U are likely to get
more responses, as people there have obtained and solved all kinds of
problems related to the AdviceClient sample in the HF EJB book.
[ March 05, 2004: Message edited by: Vish Kumar ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic