While trying to create a simple prototype for an application which uses JSF, EJB 3 and JPA, I decided to implement the suggestions from the article: Using an EJB Session Bean as a Model Facade.
I was particularly interested in injecting my EJBs to my JSF Managed Beans (the article mentioned that it should be possible to do this kind of injection with JSF Managed Beans and Servlets).
public class CatalogServlet extends HttpServlet { @EJB private CatalogFacade cf; // some variables and methods }
I tried using JBoss 4 since it already had lots of available documentation regarding EJB 3 only to find out that this feature is not yet supported.
I tried switching to JBoss 5 Beta 4 but the error was the same.
16:16:31,765 ERROR [JBossInjectionProvider] Injection failed on managed bean.
javax.naming.NameNotFoundException: “Name of your Managed Bean goes here” not bound
Hmm, I should probably try this with GlassFish one of these days.
Recommended books:
Armen said
JBoss 4.2.2 does not support @EJB annotation, because Jboss used Tomcat 5.5 that does not support jdk 1.5. JBoss 5 beta supported tomcat 6 and jdk 1.5, but it is not work properly. Use GlassFish or JBoss 4.2. 2 and instead @EJB use lookup.
Coudy said
Have you ever tried with glassfish because it would be useful for me?
Thanks
dayg said
Sorry but I did not manage to try it out in GlassFish, but I’m guessing that these resources should be able to give you an idea of what to expect:
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#mappingRemoteejbdependency