You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Thorsten Wärtel (JIRA)" <ji...@apache.org> on 2010/08/17 17:59:17 UTC

[jira] Created: (OPENEJB-1330) providing id in application-client.xml has no effect on local client module name

providing id in application-client.xml has no effect on local client module name
--------------------------------------------------------------------------------

                 Key: OPENEJB-1330
                 URL: https://issues.apache.org/jira/browse/OPENEJB-1330
             Project: OpenEJB
          Issue Type: Bug
          Components: configuration
    Affects Versions: 3.1.2
            Reporter: Thorsten Wärtel


Some weeks ago, a problem with duplicate local client module names was posted on the openejb-users mailing list:

http://openejb.979440.n4.nabble.com/OpenEJB-localclient-module-name-td2238205.html

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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENEJB-1330) providing id in application-client.xml has no effect on local client module name

Posted by "Thorsten Wärtel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thorsten Wärtel updated OPENEJB-1330:
-------------------------------------

    Attachment: AppInfoBuilder.java.patch

Patch created against openejb-3.1.x branch

> providing id in application-client.xml has no effect on local client module name
> --------------------------------------------------------------------------------
>
>                 Key: OPENEJB-1330
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1330
>             Project: OpenEJB
>          Issue Type: Bug
>          Components: configuration
>    Affects Versions: 3.1.2
>            Reporter: Thorsten Wärtel
>         Attachments: AppInfoBuilder.java.patch
>
>
> Some weeks ago, a problem with duplicate local client module names was posted on the openejb-users mailing list:
> http://openejb.979440.n4.nabble.com/OpenEJB-localclient-module-name-td2238205.html
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.