Stateless EJB implementation with @Inject in CDI Weld ManagedBean (JSF 1.2 EJB application on jboss 6 AS)

I am currently trying to implement stateless EJB in a managed CDI controller on Jboss 6 AS Final. The controller is controlled in a context accessible from JSF pages. If I enter a standless bean using @EJB, it will work. If I insert stateless EJB @Inject, I get the following exception:

My controller:

@Named("TestController")
public class TestController {   
    @Inject
    private TestManagerLocal myTestManager;
        ...
    }
}

My stateless bean:

@SuppressWarnings("unchecked")
@Stateless
public class TestManagerBean implements TestManagerLocal {

    @PersistenceContext
    private EntityManager em;
        ...
}

The bean interface is annotated with @Local.

If I try to call myTestManager, I get the following exception:

WELD-000079 EJB JNDI: class de.crud.org $JBoss $ $ bean -jboss $ : ID = "VFS: $$$ USR $ $JBoss $ $ $ $ $" -SessionBean-TestManagerBean _ $$ _ WeldProxy

.

+5
3

, . Weld , , EJB.

+1

, , :

  • EJB
  • , EJB EJB EJB
  • CDI
  • @Inject -:

:

// This bean is defined in the WEB module
@Stateless
public class EJBFactory {

    @EJB
    protected UserDAO userDAO;

    // ~X other EJBs injected here


    @Produces @EJBBean
    public UserDAO getUserDAO() {
        return userDAO;
    }

    // ~X other producer methods here
}

EJB EAR :

// This bean is also defined in the web module
@RequestScoped
public class MyBean {

    @Inject @EJBBean
    private UserDAO userDAO; // injection works

    public void test() {
        userDao.getByID(...); // works
    }

}

EJBBean - . :

@Qualifier
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
public @interface EJBBean {

}
+8

, , WARs EAR-Deployments . . https://issues.jboss.org/browse/JBAS-8683 JIRA JARA-JIRA ( :-))

. , 1 , . , , -, ...

+2
source

All Articles