0 Replies Latest reply on Jul 9, 2007 4:12 PM by Carlos Lacerda

    @EJB injection problems for managed beans and servlets

    Carlos Lacerda Newbie

      Hi all, i have created a SSB/EJB and access the same in my ManagedBean JSF and in a servlet using a commom lookup as:

      EJBX = (EJBX)(new InitialContext().lookup("ejb/EJBX"));
      i mapped the name "ejb/EJBX" in jboss.xml to local interface of my EJB. this works in Managed Bean and in Servlet.

      If i use:
      @EJB(name= "ejb/EJBX") EJBX ejb;

      in a managed bean its works fine but when try run this same code injection in a servlet the same not run, why ??

      I use a jboss-4.2.0.GA.

      Other question is when a try use for eg.
      <ejb-local-ref>
       <ejb-ref-name>SessionEJBLocal</ejb-ref-name>
       <ejb-ref-type>Session</ejb-ref-type>
       <local>jbossjpa.model.session.SessionEJBLocal</local>
       <ejb-link>ejb/SessionEJBLocal</ejb-link>
       </ejb-local-ref>


      Using a servlet version="2.5", jboss cannot deploy my application, the folowing exception is throw:
      2007-07-09 13:43:11,926 DEBUG [org.jboss.web.tomcat.service.JBossWeb] Problem in init
      org.jboss.deployment.DeploymentException: Failed to parse WEB-INF/web.xml; - nested throwable: (org.jboss.deployment.DeploymentException: expected one local-home tag)
       at org.jboss.web.AbstractWebContainer.parseMetaData(AbstractWebContainer.java:755)


      Why this error is throw ? this version of Jboss is sevlet 2.5 compatible or no ?

      Thanks!