3 Replies Latest reply on Jun 6, 2007 3:18 PM by jmiguel77

    JSF 1.2 EJB3 injection

    jmiguel77

      Hi

      I am tryingo to test the EJB3 session bean injection in a JSF managed Bean

      I hav modified my web.xml to include this

      <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
       http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      


      My ejb jar is correct and deployed; in the managed bean i have this:

      @Resource
      UserServiceLocal userService;

      but when i try to call any method in the userService, it gives me a null pointer exception

      What can i be missing ??

        • 1. Re: JSF 1.2 EJB3 injection
          wolfc

          First you should be using the @EJB annotation, not the @Resource.

          Second this thread http://www.jboss.com/index.html?module=bb&op=viewtopic&t=107353 shows you how to inject session beans into a JSF bean.

          • 2. Re: JSF 1.2 EJB3 injection
            waynebaylor

            Have you tried doing a JNDI lookup instead of injection?

            And what version of JBoss are you using? Annotation injection in servlets/JSF isn't implemented in 4.0.5 & 4.2.0.

            • 3. Re: JSF 1.2 EJB3 injection
              jmiguel77

              I have been working wiht JNDI lookups for the web layer of my applications for some time, but i wanted to give a try to the JBoss 4.2 precisely because it was stated that this version was fully Java EE compliant, but aparentlly it is not

              Thanks to wolf for the link but i found it not good enoguh. The actual version of glassfish supports @EJB injection of the session beans in the web layer without all the web.xml and jboss-web.xml complication

              Guess i'll have to wait for the JBoss 5 version