EJB到SEAM组件(不同的项目和相同的JBoss)
我有以下设置: JBoss 4.2.3EJB到SEAM组件(不同的项目和相同的JBoss),jboss,ejb-3.0,seam,Jboss,Ejb 3.0,Seam,我有以下设置: JBoss 4.2.3 下面我有: --> Project A (Wich is not SEAM 2.1.2GA based) EJBs: * beanA (JNDI = beanA/remote) * beanB (JNDI = beanB/remote) --> Project B (SEAM based) EJBs / Components: * ComponentX * ComponentY
下面我有:
--> Project A (Wich is not SEAM 2.1.2GA based) EJBs: * beanA (JNDI = beanA/remote) * beanB (JNDI = beanB/remote) --> Project B (SEAM based) EJBs / Components: * ComponentX * ComponentY -->项目A(不基于SEAM 2.1.2GA) EJB: *beanA(JNDI=beanA/远程) *beanB(JNDI=beanB/远程) -->项目B(基于SEAM的) EJB/组件: *组件X *成分 在组件X上,我有一段当前代码:
@Scope(ScopeType.CONVERSATION)
@Name("ComponentX")
public class ComponentX implements java.io.Serializable {
...
@EJB
beanAInterface beanA;
....
public foo(){
beanA.bar(); // <--------- beanA is null, even with mapped name and etc, only works
// if i direct lookup with Context().lookup("beanA/remote")
}
@Scope(ScopeType.CONVERSATION)
@名称(“组件X”)
公共类ComponentX实现java.io.Serializable{
...
@EJB
Bean界面beanA;
....
公共食物({
beanA.bar();//您的ComponentX类不是EJB,因此您不能使用@EJB注释来注入它们。您有几个选项。将您的ComponentX转换为EJB,添加@Stateless或@Statefull以及@Local或@Remote接口,这样,AS会注意到ComponentX是EJB,并且知道如何处理所需的注入。另一个选项是l将ComponentX设置为一个简单的组件,并使用InitialContext#lookup手动获取对“beanA/remote”的引用