• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB  RSS feed

 
Nedungadi Poornima
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I developed an entity bean. I wanted to refer this with a SessionFacade bean.

The code goes like this in SessionFacadeBean:

public ArrayList displayCustomer(String name){
CustomerLocal customerLocal = null;
ArrayList customerDTOs = null;

try{
InitialContext context = new InitialContext();
CustomerLocalHome customerLocalHome = (CustomerLocalHome)context.
lookup("ejb/com/bean/test/CustomerLocalHome");
Collection customers = customerLocalHome.findCustomerByName(name);
}

Here, the lookup is failing for Entity beans. Its showing NameNotFoundException in the server console.
1)Why so?

Also, I can see the Entity Bean reference in the UTC(Universal Test Client). The directory structure what i see is [Local_Bean_Home].
2)But how to refer that from within our code?

3) Do we need to do any server configuration(WSAD specific) to run the application.

Thnx in advance,

Poornima
 
Frank Ertl
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you use a session bean as a facade you have your SessionContext to do the lookup. U do not need an InitialContext.
To get this working you have to set the <ejb-ref> in the DD and do the lookup with the complete name: "java:comp/env/ejb/com/bean/test/CustomerLocalHome". Or whatever you define as the name of the reference.
Hope this helps.
 
Nedungadi Poornima
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frank!!!

It helped...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!