cancel
Showing results for 
Search instead for 
Did you mean: 

NameNotFoundException when looking up JNDI

Former Member
0 Kudos

Hi,

I'm getting the same naming exception you can see @ http://www.coderanch.com/t/51509/Struts/Calling-EJB-action-class when looking up an ejb object.

How should I lookup the object?

Thank you in advance,

Michael Jones

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello

Please try the following.

Do annotate the EJB with the corresponding name in order to identify it later on:

@Stateful(name = "MyLostEJB")

public MyLostEJB implements LostEJBRemoteHome, LostEJBLocalHome

{

public String sayHello(){ return "Hello"; }

}

And then:

LostEJBRemoteHome myEjb= null;

myEjb= (LostEJBRemoteHome ) new InitialContext().lookup("MyLostEJB/remote");

myEjb.sayHello();

I hope it helps

Alejandro