WELD-001318 无法解决不明确的依赖关系

发布于 2024-12-02 00:14:14 字数 909 浏览 2 评论 0原文

我在部署应用程序时遇到错误,如下所示。

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 {...}

请帮助。这个错误可能比我的代码更模糊。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魔法唧唧 2024-12-09 00:14:14

我因在 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>

使用 JBoss 时可以通过在部署期间检查 JNDI 绑定来检测到这一点。 EJB 被实例化多次。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文