WELD-001318 Cannot resolve an ambiguous dependency
Asked Answered
D

1

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.

Digit answered 29/8, 2011 at 20:5 Comment(1)
strange indeed. Can you make sure you don't have the same class twice on the classpath, in difference jars (bean-archives) for example?Pocked
M
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.

Mastersinger answered 1/3, 2016 at 9:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.