我正在尝试使用 WebSphere 8.5 可嵌入容器在 Maven 项目中运行以下单元测试:
import javax.ejb.embeddable.EJBContainer;
...
private EJBContainer ec;
@Before
public void setUp() {
final Map<String, Object> properties = new HashMap<String, Object>();
properties.put(EJBContainer.PROVIDER, "com.ibm.websphere.ejbcontainer.EmbeddableContainerProvider");
ec = EJBContainer.createEJBContainer(properties);
}
@Test
public void test1(){
...
}
但我在设置方法中遇到以下异常:
CNTR9403E: The embeddable enterprise bean container cannot start multiple modules with the same file name: project1\target\classes and project2\target\classes
有人知道如何解决这个问题吗?我进行了搜索,但没有找到任何有用的信息。
编辑: 我在这里找到了异常 CNTR9403E 的文档:
CNTR9403E: The embeddable enterprise bean container cannot start multiple modules with the same file name: {0} and {1}
Explanation User code has directed the embeddable container to start multiple modules with the same file name. Action Specify a list of modules that does not have duplicate file names, or rename one of the modules with a unique file name.
但我不知道如何解决这个问题。它是在提示路径末尾的两个“类”目录吗?我如何在 Maven 多模块项目中解决这个问题?还是 WebSphere 8.5 中的错误?
最佳答案
是的,classes
目录名称导致了冲突。使用这些目录名称没有解决方法,所以我建议改为测试生成的 .jar
,尽管我不熟悉 Maven,所以我不知道这有多可行。这有点不令人满意,所以你可以打开一个 WebSphere RFE允许指定属性以消除歧义。
关于java - WebSphere 8.5 : unit testing & embeddable container,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14568167/