WELD-001409 [EagerBeansRepository]类型的模糊依赖关系 [英] WELD-001409 Ambiguous dependencies for type [EagerBeansRepository]

查看:164
本文介绍了WELD-001409 [EagerBeansRepository]类型的模糊依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将我的JSF应用程序迁移到CDI。我已经实施了以下更改:


  • 向WEB-INF添加了一个空的beans.xml文件

  • 将@ManagedBean更改为@Named

  • 更改了所有范围我有CDI范围(会话,查看和请求)
  • 更改了所有@ EJB和@ManagedProperty到@Inject



但是,Omnifaces错误阻止部署,因为我收到以下错误三次:


org.jboss.weld.exceptions.DeploymentException:WELD-001409注入点处带有限定符[@Default]的[EagerBeansRepository]类型的模糊依赖关系[[BackedAnnotatedField] @Inject private org.omnifaces.ApplicationListener.eagerBeansRepository]。可能的依赖[[Managed Bean [class org.omnifaces.cdi.eager.EagerBeansRepository]]限定符[@Any @Default],Managed Bean [带有限定符的[org.omnifaces.cdi.eager.EagerBeansRepository]] [@Any @Default]] ]


我已将其降级为Omnifaces 1.8.1,并且部署成功。为什么Omnifaces 2.0会导致这个错误?



开发环境:


  • Glassfish 4

  • Omnifaces 2.0

  • JSF(Mojarra 2.2.0)
  • WELD-000900 2.0.0 )


解决方案

这个异常表明OmniFaces JAR(特别是包含提到的歧义类的JAR ,在你的特定情况下 EagerBeansRepository )在运行时类路径中被复制。假如JAR被正确地放置在webapp的 / WEB-INF / lib 中而不在其他地方,那么如果GlassFish工作文件夹在部署之前未被正确清理,就会发生这种情况。特别是GlassFish Eclipse插件已知会在此失败。您需要手动清理 / glassfish / domains / [domainname]中的GlassFish工作文件夹。



顺便说一句,当您处于这种状态时,我强烈建议升级到GlassFish 4.1。 GlassFish 4.0与每一个GlassFish发行版都一样(所有麻烦事都让它成为第一个Java EE X应用服务器以及每一个新的Java EE API版本)都会有太多童年的错误。

I'm trying to migrate my JSF application to CDI. I have implented the following changes:

  • Added an empty beans.xml file to WEB-INF
  • Changed @ManagedBean 's to @Named
  • Changed All the scopes I have to CDI Scopes (Session, View, Request)
  • Changed all @EJB and @ManagedProperty to @Inject

However, an Omnifaces error is preventing deployment as I'm getting the following error three times:

org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [EagerBeansRepository] with qualifiers [@Default] at injection point [[BackedAnnotatedField] @Inject private org.omnifaces.ApplicationListener.eagerBeansRepository]. Possible dependencies [[Managed Bean [class org.omnifaces.cdi.eager.EagerBeansRepository] with qualifiers [@Any @Default], Managed Bean [class org.omnifaces.cdi.eager.EagerBeansRepository] with qualifiers [@Any @Default]]]

I have downgraded to Omnifaces 1.8.1 and the deployment was successful. Why Omnifaces 2.0 resulting in this error?

Development Environment:

  • Glassfish 4
  • Omnifaces 2.0
  • JSF (Mojarra 2.2.0)
  • WELD-000900 2.0.0 (SP1)

解决方案

This exception suggests that OmniFaces JAR (specifically, the JAR containing the mentioned ambiguous class, which is in your particular case EagerBeansRepository) is duplicated in runtime classpath. Provided that the JAR is properly placed in /WEB-INF/lib of the webapp and not elsewhere, then this can happen if GlassFish work folders are not properly cleaned up before deploy. Particularly the GlassFish Eclipse plugin is known to fail in this. You'd need to manually clean up the GlassFish work folders in /glassfish/domains/[domainname].

By the way, while you're at it, I strongly recommend to upgrade to GlassFish 4.1 as well. GlassFish 4.0 has like every first GlassFish release (all the hassle to get it ready as "First Java EE X Application Server" along with every new Java EE API release) way too many childhood bugs.

这篇关于WELD-001409 [EagerBeansRepository]类型的模糊依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆