Some weeks ago, a problem with duplicate local client module names was posted on the openejb-users mailing list:
I am having the same problem in the following scenario:
- multi-module project
- module-a tests do local client injection, so there is an application-client.xml present in module-a/target/test-classes/META-INF
- module-a builds an attached test-jar
- module-b has a dependency on module-a's test-jar
- module-b also does local client injection
If I run tests in this project from command line, everything works fine in module-b: LocalClients from module-a are deployed with a local client module name of "module-a-1.0.0-SNAPSHOT-tests" and LocalClients from module-b use module name "test-classes".
However, if I run tests in eclipse (using m2eclipse 0.10.2), a NameAlreadyBoundException is raised because LocalClients from module-a are already bound using alocal client module name of "test-classes", so module-b's LocalClients try to bind under the same name.
The first reply on the mailing list hints that using a unique id attribute in application-client.xml would prevent this, but unfortunately this does not work in 3.1.2 (and current 3.1.3-SNAPSHOT).
Doing some debugging, I found out that the id attribute is correctly set into class ApplicationClient when reading application-client.xml and also correctly passed on to class ClientModule. But I think there might be an error in AppInfoBuilder.getClientModuleId(ClientModule), where a module id is determined from ClientModule.getJarLocation() instead ClientModule.getModuleId(). The moduleId is already set to jarLocation in ClientModule, if no explicit id is provided. Changing getClientModuleId() to use getModuleId() did the trick for me, application-client.xml ids are now used as local client module names and there is no NameAlreadyBoundException raised anymore.
I will attach a patch containing the change I made.