File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes HFEJB AdviceClient  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "HFEJB AdviceClient  " Watch "HFEJB AdviceClient  " New topic

HFEJB AdviceClient

Alfred Harre
Ranch Hand

Joined: Apr 29, 2004
Posts: 73
After deploying Advice bean from HFEJB when I try to run it, I get following error.

javax.naming.NameNotFoundException: Adivsor not found
<<no stack trace available>>

Any ideas, help is greatly appreciaed.
Alfred Harre
Ranch Hand

Joined: Apr 29, 2004
Posts: 73
This error was because the source code for provided by the authors tries to look up for "Test1" on JNDI look up where as they advise to register it as "Advisor" when deploying and hence JNDI lookup fails.
Thanks God, I have succeeded in compiling and running first example after struggling one whole week :roll:
I would like to suggest following for others who are starting first chapter of HFEJB
1. Use same version of J2SDK and J2EE (1.3)
2. On windows use following command to compile
javac -classpath %CLASSPATH%;c:<YOUR_PATH>AdviceAppClient.jar (command given in book is good for Linux)
3. If you are using source code provided by authors make sure you open AdviceClient.jar and pay attention to this line
Object o = ic.lookup("Test1"); // replace with YOUR JNDI name for the bean
4. These notes by authors are also helpful NOTES BY AUTHORS
5. You might wana go through this errata by the publisher ERRATA
I hope no one else will stuck on the very first chapter for a week as I have been :roll:
Regards and thanks to all those who really helped me. Specail thanks to Dale_Seng for really helping me.
[ May 06, 2004: Message edited by: Alfred Harre ]
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
I also had a bit of a hard time with the so-called "Advice Guy".

What was weird was the getAdvice() method was throwing a RemoteException
when I was trying to run my client (from eclipse).

I tried changing the getAdvice() implementation to returning a simple String instead of getting a random entry from the array and it worked!

I then tried moving the contents of my getAdvice() method and the array containing the advices to the client to check if there were errors with it.
But it worked fine when I transferred the code to the client. I'm still wondering what caused the problem.

I'll try to post here the complete stack trace tomorrow.

Thanks a lot!

SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
Here goes my stack trace:

Kathy Sierra
Cowgirl and Author

Joined: Oct 10, 2002
Posts: 1589
The infamous "CORBA.BAD_OPERATION" error in the Advice Guy tutorial is virtually always caused by a bug in the J2EE RI (on most Windows implementations) and is detailed here;

CORBA ERROR notes for advice guy

The short version is, if you rename the method to something that doesn't match the interface name (instead of interface Advice and a method getAdvice(), change the method name to *anything else* like getMessage()). This is indeed a CORBA issue that *can* crop up, and as you all know from being Java folks--not a Java limitation or an RMI problem, or anything that *you* have done wrong. We made the mistake of testing this ONLY on the Linux version of the RI, under OSX (which, to show my inherent bias, always works perfectly )

Again, our apologies for those of you who had to struggle with it. Wish I could say that it's helping you learn EJB, but it's probably more like an exercise in patience.

Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
Thanks so much Kathy! (and Bert too of course)

For making "learning EJB" fun...

*** Volunteer Your PC ***

Help in the research of the following diseases:

Alzheimer's, Mad Cow (BSE), CJD, ALS, and Parkinson's. (Team 2291/Philippines)

Cancer, Anthrax, and Smallpox. (Team Philippines)
I agree. Here's the link:
subject: HFEJB AdviceClient
jQuery in Action, 3rd edition