0 Replies Latest reply on Oct 24, 2011 6:50 AM by D. Marantis

    GateIn with EJB3 injection problem

    D. Marantis Newbie

      First i've written a simple ejb applikation as jsf1.2 war file which use an external ejb function. this web application runs without any problems if i call it directly on a JBoss AS 5.1.

       

      But if i move the code from the normal jsf 1.2 war file to a GateIn 3.1 jsf portlet then the @ejb will not be instanced.

       

      So, what i've additional to do in a GateIn portlet to be possible to use an ejb3? (without using seam or spring)

       

       

      faces-config.xml

       


      <managed-bean>

      <managed-bean-name>user</managed-bean-name>

      <managed-bean-class>mytest.beans.managed.UserBean</managed-bean-class>

      <managed-bean-scope>request</managed-bean-scope>

      </managed-bean>

       

      in my managed bean:

       

      public class UserBean {

      @EJB(mappedName="EATestCalculator/local")

      private EATestCalculatorIF ejbCalc;

      ...

      }

       

      EJB is defined in a seperate jar file as

       

      @Local

      public interface EATestCalculatorIF {

          public int add(int a, int b);

      }

       

      @Stateless(name="EATestCalculator")

      public class EATestCalculatorImpl implements EATestCalculatorIF {

          public int add(int a, int b) {

              return a + b;

          }

      }

       

       

      The managed bean will be called correctly in the both (native jsf webapp and GateIn jsf portlet) but ...

       

      if i call the jsf page over the the GateIn portlet then

      this.ejbCalc.add(1,2) => NullPointer Exception! ejbCalc = null

       

      if i call the jsf page directly over the jsf web link then

      this.ejbCalc.add(1,2) => instanced and works correctly

       

       

      Only if i load the ejb in the portlet manually from the context like with ...

       

      Context context = new InitialContext();

      this.ejbCalc = (EATestCalculatorIF) context.lookup("EATestCalculator/local");

       

      ... i'll be able to use it.

       

      additional i've found in the server.log

       

      2011-10-24 12:33:52,880 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] JSF1029: The specified InjectionProvider implementation 'org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider' does not implement the InjectionProvider interface.

       

      by using JBoss AS 5.1 + GateIn 3.1 + PortalBridge 2

       

       

      So, what i've to do for the @EJB injection in GateIn 3.1?