部署我的应用程序时遇到错误,如下所示..
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)]]
我只有这样的方法,其标题看起来像这样
@Produces @Config public String getConfigurationValue(InjectionPoint p) throws ConfigurationException{...}
和班级有这些
@Named
@Singleton
@Startup
public class ConfigurationProvider {...}
请帮忙。这个错误可能比我的代码更模糊。
答案 0 :(得分:1)
我在2个不同的模块中意外使用相同的EJB名称“ExternalClient”,从而发生了这个错误。
<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>
通过在部署期间检查JNDI绑定来使用JBoss时可以检测到这一点。 EJB不止一次被实例化。