How to use JNDI to obtain a new Stateful Session Bean, in EJB3?

Posted by FarmBoy on Stack Overflow See other posts from Stack Overflow or by FarmBoy
Published on 2010-05-15T03:09:06Z Indexed on 2010/05/15 3:14 UTC
Read the original article Hit count: 452

I'm trying to use JNDI to obtain a new Stateful Session Bean in a servlet (as a local variable). My doGet() method has the following:

Bean bean = (Bean) new InitialContext().lookup("beanName");

I've tried including java:comp/env but all of my attempts have led to naming exceptions.

I'm attempting to bind the bean in the @Stateful annotation, using various guesses like @Stateful(name="beanName") and @Stateful(mappedName="beanName")

© Stack Overflow or respective owner

Related posts about ejb3

Related posts about java