7

I am getting an error when deploying my application as follows..

Caused by: org.jboss.weld.exceptions.AmbiguousResolutionException: WELD-001318 Cannot resolve an ambiguous dependency between [
Producer Method [String] with qualifiers [@Any @Config] declared as [[method] @Produces @Config public ca.comdev.cdip.mis.enterpriseportal.configuration.ConfigurationProvider.getConfigurationValue(InjectionPoint)], 

Producer Method [String] with qualifiers [@Any @Config] declared as [[method] @Produces @Config public ca.comdev.cdip.mis.enterpriseportal.configuration.ConfigurationProvider.getConfigurationValue(InjectionPoint)]]

And I only have on such method whose header looks like this

@Produces @Config public String getConfigurationValue(InjectionPoint p) throws ConfigurationException{...}

and class has these

@Named
@Singleton
@Startup
public class ConfigurationProvider {...}

Please help. This error is probably more ambiguous than my code.

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
Peter Vanleeuwen
  • 327
  • 3
  • 10
  • strange indeed. Can you make sure you don't have the same class twice on the classpath, in difference jars (bean-archives) for example? – Bozho Aug 29 '11 at 20:14

1 Answers1

1

This error occurred to me by accidentally using the same EJB name "ExternalClient" in 2 different modules.

 <enterprise-beans>
    <session>
        <ejb-name>ExternalClient</ejb-name> <!-- DUPLICATED -->
        <ejb-class>com.company.ExternalClient</ejb-class>
        <session-type>Stateless</session-type>
        <env-entry>
            <env-entry-name>url</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>http://company.com/API</env-entry-value>
        </env-entry>
    </session>
</enterprise-beans>

This could be detected when using JBoss by checking the JNDI bindings during deployment. The EJB was instantiated more than once.

Pool
  • 11,999
  • 14
  • 68
  • 78