jakarta-eecdiresin

What is the cause of Resin saying `@Named('dpa') is a duplicate name for ...` when there is no such value?


I have an existing Java EE 7 webprofile web application working on TomEE and Glassfish. I have now tried to deploy it on Resin 4.0.55 Open Source edition. My mechanism to have CDI inject configuration strings using @Named("key") String fails with:

/home/tra/Hentet/resin-4.0.55/conf/app-default.xml:55: @Named('dpa') is
a duplicate name for
  ProducesMethodBean[String, IngesterModule.provideDestinationPath(), {@javax.inject.Named(value=dpa.putfile.destinationpath), @Default(), @Any()}, name=dpa.putfile.destinationpath]
  ProducesMethodBean[String, IngesterModule.provideDeliveriesFolder(), {@javax.inject.Named(value=dpa.deliveries.folder), @Default(), @Any()}, name=dpa.deliveries.folder]

There is no @Named("dpa") in my source, but the names listed in the error message have keys starting with dpa.

What does this mean? What is the cause? and how do I fix it?


Solution

  • The message "@Named('{0}') is a duplicate name for\n {1}\n {2}" is found inside the InjectManager.java class file.

    Relevant source code:

      private void addBeanByName(String name, Bean<?> bean)
      {
    ...
        // ioc/0g31
        int p = name.indexOf('.');
        if (p > 0) {
          addBeanByName(name.substring(0, p), bean);
        }
      }
    

    The given name is splitted using the period character ('.') as separator, and the given bean is added to the context for each part recursively. This behaviour must be described in the CDI 1.0 (JSR-299) or maybe the implementation is buggy.

    The ioc/0g31 comment looks like a reference to an issue, but I couldn't find it in the bug tracking system.