Question

We are using JDeveloper 11g. Both a Model and ViewController project that makes use of ADF fusion and what not.

My web-xml has an EJB reference for a stateful session EJB . I have a managed bean that's declared in faces-config.

I am trying to access a EJB from inside the managed bean.

I declare

@EJB (name ="LocationServicesEJB")
private LocationServicesEJB locationServices;

When accessing this in a method, the locationServices is null. I do not see any JNDI type problems in the console, so I imagine that it's not even bothering to lookup.

Do I need to enable injection or something? Or do I need to define 'locationServices' as managed property in my faces-config?

Please advise. Thanx

Was it helpful?

Solution

You are confusing two different types of injection.

  1. There is EJB injection that happens among EJBs by the respective annotation. This type is handled by the EJB container (your application server or OpenEJB e.t.c)

  2. Then there is "normal" injection (ala Spring) that happens between normal Java beans and is defined in faces-config. This type is handled by JSF.

So decide what you want to do.

My proposal would be to download the official Java EE tutorial and skim through all topics.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top