Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSphere 8.5: unit testing & embeddable container

I'm trying to run the following unit test in a Maven project using a WebSphere 8.5 embeddable container:

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(){
...
}

But I'm getting the following exception in the setup method:

CNTR9403E: The embeddable enterprise bean container cannot start multiple modules with the same file name: project1\target\classes and project2\target\classes

Does anybody know how to get around this issue? I searched but couldn't find anything useful.

Edit: I've found the documentation for the exception CNTR9403E here:

http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.messages.doc%2Fcom.ibm.ejs.container.container.html

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.

But I don't see how I can fix this. Is it complaining about the two "classes" directories at the end of the paths? How can I solve this in a Maven multi-module project? Or is it a bug in WebSphere 8.5?

like image 960
Puce Avatar asked May 15 '26 22:05

Puce


1 Answers

Yes, the classes directory name is causing the conflict. There is no workaround for using those directory names, so I would recommend testing the generated .jar instead, though I have no expertise with Maven, so I don't know how feasible that is. This is somewhat unsatisfactory, so you could open a WebSphere RFE to allow properties to be specified to disambiguate.

like image 114
Brett Kail Avatar answered May 18 '26 11:05

Brett Kail



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!