users@glassfish.java.net

Dependency Injection is not working

From: <glassfish_at_javadesktop.org>
Date: Sun, 28 Feb 2010 14:59:49 PST

Hi,

I found no way to get Dependency Injection working in Glassfish v3. I have this little test-bean:

@Stateless
public class CalcSessionBean implements CalcSessionBeanRemote, CalcSessionBeanLocal {

    @Resource
    SessionContext sessctx;

    public Integer add(int a, int b) {
        System.out.println("ctx:" + sessctx);
        return a + b;
    }
}

But the injected Context is null. In another bigger Bean I also get no EntityManager or EntityManagerFactory injected (with @PersistentContext/_at_PersistenceUnit). The only one Injection that is working is @EJB to get References to other SessionBeans. Is this a problem in the Glassfish-Configuration?

Which log-layer should be set finer to look at this problem? I tried to set all to FINEST, but this is giving far too many output to read.

I hope someone can help me.
Greets
[Message sent by forum member 'homer86' (baltasar86_at_web.de)]

http://forums.java.net/jive/thread.jspa?messageID=389255