Local Interface Lookup in Entity Bean

Posted on 2005-05-02
Medium Priority
Last Modified: 2013-12-10
Can anyone tell me like how to lookup an local Interface of an entity bean in Websphere or WSAD?

Question by:Murali Murugesan
LVL 14

Expert Comment

ID: 13924106
Try the following codes.
    InitialContext initContext = new InitialContext();
    EJBLocalHome localHome = (EJBLocalHome) initContext.lookup("java:comp/env/" + jndiHomeName);
    SomeBeanLocal entity = localHome.findByPrimaryKey("1");

The varible 'jndiHomeName' is the ejb reference name created on the session bean.
Refer to redbook http://publib-b.boulder.ibm.com/abstracts/sg246957.html (Chapter 12 Implementing the session facade) on how to create the ejb reference.

You can also refer to the J2EE design pattern http://java.sun.com/blueprints/patterns/ServiceLocator.html for the above codes.

Boon Leng
LVL 13

Author Comment

by:Murali Murugesan
ID: 13924521
I have solved the problem myself.

I had already written the above code.I also created the reference for the bean as boonleng.

The mistake was i didnt create a reference in the web.xml for that local bean.Once i created that my code was working fine.

Thanx for the help.



Accepted Solution

DarthMod earned 0 total points
ID: 14240030
PAQed with points (50) refunded

Community Support Moderator

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question