Hi,
I'm currently working on my first EJB3 project (actually my first
project involving EJB at all).
So I wrote an entity bean and a statless bean. So far so good. Then I
wrote a servlet where I want to use my session bean so I included
something like at the class-scope of my Servelt:
[...]
public class CustomerServlet extends HttpServlet
{
@[EMAIL PROTECTED]
customerDispatch;
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
[...]
Unfortunatly this doesn't seem to work, altough I've seen this kind of
code as an example on how to smoothly refer to bean. The variable
"customerDispatch" is alwas null :(
I also tried writing a standalone client, using the same annotation, and
still ... the variable is null.
Only when using something like:
Context context;
ICustomerDispatcher customerDispatch;
try
{
context = new InitialContext();
customerDispatch = (ICustomerDispatcher)
context.lookup(CustomerDispatcherBean.class.getSimpleName() + "/local");
}
catch (NamingException e)
{
e.printStackTrace();
throw new RuntimeException(e);
}
I get my dispatcher-inctance.
Could anyone give me some advice what's going wrong?
Thx!