Local Interface Lookup in Entity Bean

Posted on 2005-05-02
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

    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 (Chapter 12 Implementing the session facade) on how to create the ejb reference.

    You can also refer to the J2EE design pattern for the above codes.

    Boon Leng
    LVL 13

    Author Comment

    by:Murali Murugesan
    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.


    LVL 1

    Accepted Solution

    PAQed with points (50) refunded

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Suggested Solutions

    -Xmx and -Xms are the two JVM options often used to tune JVM heap size.   Here are some common mistakes made when using them:   Assume BigApp is a java class file for the below examples. 1.         Missing m, M, g or G at the end …
    Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now