Hi, 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. Regards
posted 16 years ago
This error was because the source code for AdviceClient.java 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 AdviceClient.java (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. Regards [ May 06, 2004: Message edited by: Alfred Harre ]
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.
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.