Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-1330

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.2, 3.1.4, 4.0-beta-1
    • Fix Version/s: 4.0-beta-1
    • Component/s: configuration
    • Labels:
      None

      Description

      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.

        Attachments

        1. AppInfoBuilder.java.patch
          0.7 kB
          Thorsten Wärtel
        2. testcase-injection.zip
          15 kB
          Thorsten Wärtel

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                thwaerte Thorsten Wärtel
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: