Link to home
Start Free TrialLog in
Avatar of prreddy
prreddy

asked on

Local JNDI lookup

Hi,
I am using j2ee application with session ejbs on WSAD5.0. I have both remote and local interfaces in my bean. Initiall i used jndi lookup using remotehome object,it works fine.Later,i tried using localhome look up...  I am getting following exception...Is there something i missed..I would appreciate if anybody help on this...

 javax.naming.NameNotFoundException: Name "ejb/ejb/us/ds/ejb/person/PersonLocalHome" not found in context "local

//client code
InitialContext context = new InitialContext();
 perHome = (PersonLocalHome)context.lookup("local:ejb/ejb/us/ds/ejb/person/PersonLocalHome");

In ejb-jar-bnd.xmi,i have something like this..
<ejbBindings xmi:id="EnterpriseBeanBinding_1094579280078" jndiName="ejb/us/ds/ejb/person/PersonLocalHome">
    <enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml#Person"/>
    <ejbRefBindings xmi:id="EjbRefBinding_1094580260062" jndiName="local:ejb/ejb/us/ds/ejb/person/PersonLocalHome">
      <bindingEjbRef xmi:type="common:EJBLocalRef" href="META-INF/ejb-jar.xml#EJBLocalRef_1094580260062"/>
    </ejbRefBindings>
  </ejbBindings>

thanks.
Avatar of ldbkutty
ldbkutty
Flag of India image

Try this:

InitialContext context = new InitialContext();
perHome = (PersonLocalHome)context.lookup(PersonLocalHome.JNDI_NAME);
Avatar of prreddy
prreddy

ASKER

you mean JNDI_NAME is local jndiname right, but its not accepting if i say PersonLocalHome.JNDI_NAME
Avatar of prreddy

ASKER

Any help appreciated for the above problem!!!!!!!
Are you getting the same error?

one suggestion: You can post this Question in Java TopicArea, where you can get earlier & excellent responses than here. https://www.experts-exchange.com/Programming/Programming_Languages/Java/

You can also post a "20 points" Question there with the link of this Question in the body. (and subject - something like - Link to EJB Question.)
Avatar of prreddy

ASKER

I appreciate your help... I tried different ways ,it works fine...Actually we need to specify local reference in web.xml, that solved the problem.
ASKER CERTIFIED SOLUTION
Avatar of GhostMod
GhostMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial