Discussions

Hi there,
I am able call EJB3.0 stateless session bean from servlet client using @EJB annotation(no lookup). But when I try to call the same bean from action class, its throwing NullPointerException.
@EJB
private EJB3Sample ejb3Sample;
When I print ejb3Sample object reference, its showing
Null.
1)Can anyone explain the reason why the remote interface (POJI as per EJB3.0 docs) is null in action class whereas its available in servet?
2)can't we use @EJB in action class(POJO)?
3)We can use lookup in action class to get the bean, like...context.lookup("EJB3Sample#com.test.EJB3Sample")
though this is working then whats the use of dependency injection?
Thanks in advance,
Rajesh

1)Can anyone explain the reason why the remote interface (POJI as per EJB3.0 docs) is null in action class whereas its available in servet? 2)can't we use @EJB in action class(POJO)?3)We can use lookup in action class to get the bean, like...context.lookup("EJB3Sample#com.test.EJB3Sample")though this is working then whats the use of dependency injection?

TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations technology projects - with its network of technology-specific websites, events and online magazines.