Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

headfirst ejb AdviceClient problem

Mat Matthew
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
New to EJB here.I am trying to run the AdviceClient problem from HeadFirst EJB book and I am getting a ClassCastException with the following code. I was able to deploy the bean and I am trying to run the client test from command line.

Context ic = new InitialContext();
Object o = ic.lookup("Advisor");
**** AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o,AdviceHome.class);
Advice advisor = home.create();

I am getting exception on the line PortableRemoteObject.narrow......

In other words how do I
1.Select the service provider of the corresponding service I want to access.
2.Specify any configuration that the initial context needs.

I am trying to run a client from command line in order to test a stateless session bean as given in HeadFirstEJB (

I am using j2sdkee1.3.1 from Sun.

Thanks in advance
[ May 07, 2005: Message edited by: Mat Matthew ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic