【发布时间】:2012-07-05 13:52:17
【问题描述】:
环境
- 两个具有远程接口的无状态 EJB。 EJB1 被注入到 EJB2 中。
/// EJB1
package com.xxx.layer1;
@Remote
public interface EJB1Remote {
}
@Stateless (mappedNamed="com.xxx.EJB1")
public class EJB1 implements EJB1Remote {
}
/// EJB2
package com.xxx.layer2;
import com.xxx.layer1;
@Remote
public interface EJB2Remote {
}
@Stateless (mappedNamed="com.xxx.EJB2")
public class EJB2 implements EJB2Remote {
@EJB(mappedNamed="com.xxx.EJB1")
EJB1Remote ejb1;
}
EJB2 还使用一些可选包(在其 MANIFEST 中声明)
WebLogic 应用服务器 (10.3.3)
两个 EJB 被打包到两个单独的 JAR 文件中
问题
如果将两个 JAR 文件打包到一个 EAR 文件中并进行部署,则依赖注入有效。但是如果我单独部署它们,即使在我首先部署了 EJB1 并在 Weblogic 中验证了全局 JNDI 名称之后 (com.xxx.EJB1#com.xxx.layer1.EJB1Remote ),EJB2 的部署失败并出现 ClassNotFoundException: com.xxx.layer1.EJB1Remote
【问题讨论】:
标签: java dependency-injection ejb weblogic-10.x