users@glassfish.java.net

Re: Debug _at_EJB (javax.ejb.EJB) annotation in Web Application

From: Adam Bien <abien_at_adam-bien.com>
Date: Sun, 15 Mar 2009 20:45:22 +0100

Hi,

you can only inject into servlets, backing beans etc. This works
perfectly (I do it daily :-)). You should choose the Java EE 5 setting
in your web projects...

regards,

adam
glassfish_at_javadesktop.org schrieb:
> Hi,
> I have an Enterprise Application with EJB module and Web module.
> The EJB module has simple stateless session bean with local interface only.
> The Web module uses the EJB module and has @EJB annotation on a field referring to the local interface of the stateless session bean.
>
> For some reason it does not inject the bean instance. The field remain null.
>
> I'm using NetBeans 6.5 for development so I used the built-in "Call Enterprise Bean" functionality and it add a JNDI lookup method and the following entry to my web.xml file:
>
> <ejb-local-ref>
> <ejb-ref-name>ObjectTypeFacade</ejb-ref-name>
> <ejb-ref-type>Session</ejb-ref-type>
> <local-home>org.dna.aurora.core.objectTypeFacade</local-home>
> <local>org.dna.aurora.core.objectTypeFacade</local>
> <ejb-link>Aurora-ejb.jar#ObjectTypeFacade</ejb-link>
> </ejb-local-ref>
>
> The lookup code simply create InitialContext and perform lookup for "java:comp/env/ObjectTypeFacade".
>
> Can anyone help me understand what am I doing wrong?
> What is the name of the variable should be? Should I add arguments to the @EJB annotation?
>
> Thank you very much,
> Ido.
> [Message sent by forum member 'ido_ran' (ido_ran)]
>
> http://forums.java.net/jive/thread.jspa?messageID=337026
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>


-- 
 Consultant, Author, Java Champion
 
 Homepage: www.adam-bien.com
 Weblog: blog.adam-bien.com
 eMail:  abien_at_adam-bien.com
 Mobile: 0049(0)170 280 3144
 Books: Enterprise Architekturen (ISBN: 393504299X),
        Java EE 5 Architekturen  (ISBN: 3939084247),
        J2EE Patterns, J2EE Hotspots, Enterprise Frameworks and Struts