Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF - Chapter 1 Bean

 
Andree Charfen
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI. I have the HF book. In chapter 1 there is an example called the Advice Guy. I got it compiling and everything but at runtime the JNDI cannot find the bean (when the context does the lookup). The server is running as well as the Bean. And I did set the right bean JNDI name. But it just wont do it. I dont have the excact error with me, but I do know it was that the JNDI couldnt find the Bean.

What else could I be missing? Thank you for your help.
[ May 12, 2005: Message edited by: Andree Charfen ]
 
Andree Charfen
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hummmmm..... I was doing a little research and I found an example that does a lookup and it includes the whole path, like this:

"java:comp/env/com/app/beanjndi"

humm.... I thought you did have to do that. The HF book doesnt show the whole path.

 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which app server you are using. You can check the JNDI tree that the name of the bean is registered there .

cheers.
 
Andree Charfen
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh I would really like to chech that tree. Now for the App Server that I am using well here is what I am doing (I am new at EJB):

I am using the newst J2EE server (1.4). I know that b/c I downloaded it a few days ago. I am using the deploytool to start my EJB and its JNDI name. The client I am coding it in Eclipse (I dont think that matters anyways).

In the deploytool it does show that my ejb is running. But what else can I do?
 
Andree Charfen
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the exception:

javax.naming.NoInitialContextException

Here is the code line:

Object o = ic.lookup("java:comp/env/Advisor");

I have tried also:

Object o = ic.lookup("Advisor");

and yes Advisor is the JNDI name for the EJB Object.

Any ideas :roll:

OH and I start the server from the J2EE 1.4 SDK start menu where it says start default server. Is that correct? AH!
[ May 13, 2005: Message edited by: Andree Charfen ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic