Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Beans > EJB3 Injection
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 1285 of 1372
Post > Topic >>

EJB3 Injection

by Henning Eiben <eiben@[EMAIL PROTECTED] > Feb 8, 2007 at 08:51 AM

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!
 




 5 Posts in Topic:
EJB3 Injection
Henning Eiben <eiben@[  2007-02-08 08:51:38 
Re: EJB3 Injection
Per Newgro <per.newgro  2007-02-08 11:02:19 
Re: EJB3 Injection
Henning Eiben <eiben@[  2007-02-08 16:41:49 
Re: EJB3 Injection
Per Newgro <per.newgro  2007-02-09 12:02:45 
Re: EJB3 Injection
Henning Eiben <eiben@[  2007-02-14 17:21:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 4:30:19 CDT 2008.