使用@Inject将无状态EJB注入CDI Weld ManagedBean(jboss 6 AS上的JSF 1.2 EJB应用程序) [英] Inject a stateless EJB with @Inject into CDI Weld ManagedBean (JSF 1.2 EJB Application on jboss 6 AS)

查看:93
本文介绍了使用@Inject将无状态EJB注入CDI Weld ManagedBean(jboss 6 AS上的JSF 1.2 EJB应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在尝试将无状态EJB注入Jboss 6 AS Final上的CDI托管控制器中。在上下文中可以从JSF页面访问控制器。如果我用 @EJB 注入无状态Bean,那么它将起作用。如果使用 @Inject 注入无状态EJB,则会出现以下异常:

Currently I am trying to inject a stateless EJB into a CDI managed controller on Jboss 6 AS Final. The controller is managed in the context an accessible from the JSF pages. If I inject the stateless bean with @EJB it is working. If I inject the stateless EJB with @Inject I get the following Exception:

我的控制器:

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

我的无状态豆:

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

    @PersistenceContext
    private EntityManager em;
        ...
}

Bean的接口用@注释本地。

The Interface of the Bean is annotated with @Local.

如果我尝试调用myTestManager,则会收到以下异常:

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


WELD-000079在JNDI中找不到EJB:类
de.crud.org $ jboss $ weld $ bean-jboss $ classloader:id = vfs:$$$ usr $ local $ jboss $ server $ default $ deploy $ test $ ear -SessionBean-TestManagerBean _ $$ _ WeldProxy

WELD-000079 Could not find the EJB in JNDI: class de.crud.org$jboss$weld$bean-jboss$classloader:id="vfs:$$$usr$local$jboss$server$default$deploy$test$ear"-SessionBean-TestManagerBean_$$_WeldProxy

很多次THX。

推荐答案

问题是,我构建并部署了应用程序。当我将应用程序部署为包括所有EJB的战争时,Weld工作正常。

The problem was, that I built and deployed my application as an ear. Weld is working when I deploy my application as an war including all EJBs.

这篇关于使用@Inject将无状态EJB注入CDI Weld ManagedBean(jboss 6 AS上的JSF 1.2 EJB应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆