JNDI Name for Local interface EJB
Hello,
I have created a simple Stateless session bean in EJB 3.0 and deployed it. I use NetBeans 5.5. beta 2 to deploy that EJB application to SJSAS 9.0.
My problem is, i am unable to access it from web application running
in the same server - SJSAS.
I don't know what is thejndi name that is assigned to EJB with only
one local interface.
Your help will be very much appreciated!
Thank you,
Srikanth.
# 2
Hello Srikanth,
Is the web component and the ejb part of the same application? If so,
all you have to do is to use the @EJB annotation in your servlet to
inject the StatelessSession bean. You could use the following as an example:
Assuming you StatelessSessionBean implements a business interface called
Foo, all you have to do is in you Servlet use the @EJB annotation
import javax.ejb.EJB;
MyServlet extends ...{
@EJB Foo foo;
//init and service methods for your servlet
{
.......
foo.someMethod();
}
}
regards,
-marina