使用weld-se-core 和weld-servlet-core 时CDI 停止工作?

发布于 2024-11-19 02:47:49 字数 1626 浏览 4 评论 0原文

我正在玩Weld-SE。我有一个具有可插入模块的项目。只需一个模块,即可进行焊接。当使用 weld-servlet-core 的其他模块放在类路径(及其依赖项)上时,CDI 停止工作,并给出诸如“无法解析依赖项 XY”之类的错误或(删除该 >@Inject) this:

Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: WELD-001417 Enabled interceptor class <class>org.jboss.weld.environment.se.jpa.JpaTransactionInterceptor</class> in jar:file:/mnt/ssd1/data/.m2/repository/org/jboss/jawabot/JawaBot-core/2.0.0-SNAPSHOT/JawaBot-core-2.0.0-SNAPSHOT.jar!/META-INF/beans.xml@11 is neither annotated @Interceptor nor registered through a portable extension
    at org.jboss.weld.bootstrap.Validator.validateEnabledInterceptorClasses(Validator.java:466)
    ...

虽然该类有 @Interceptor (并且同一个类可以与其他模块一起正常工作)。

当我调试 WeldBootstrap#startContainer(Environment 环境,Deployment 部署) 时, deployment.beanDeploymentArchive.beanClasses 包含拦截器 (“org.jboss.weld.environment.se.jpa.JpaTransactionInterceptor”)。

我检查了依赖项和 TattleTale 报告,它们看起来都很好。

有什么想法我接下来应该看/尝试什么吗?

该项目位于 http://ondrazizka.googlecode.com/svn/ trunk/bots/JawaBot/branches/2.0/ 要查看错误,请运行 mvn dependency:copy-dependencies java -cp ... org.jboss.jawabot.JawaBotApp 或者直接在 NetBeans 中运行 Web 模块。

谢谢,Ondra

更新: JIRA:https: //issues.jboss.org/browse/WELD-940
另外,我发现这可能是由 Weld 的扫描扩展 中的错误引起的。

I am playing with Weld-SE. I have a project which has pluggable modules. With one module, weld works. When other module, which uses weld-servlet-core, is put on classpath (with it's deps), CDI stops working, giving errors like "Unable to resolve dependency XY" or (after removing that @Inject) this:

Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: WELD-001417 Enabled interceptor class <class>org.jboss.weld.environment.se.jpa.JpaTransactionInterceptor</class> in jar:file:/mnt/ssd1/data/.m2/repository/org/jboss/jawabot/JawaBot-core/2.0.0-SNAPSHOT/JawaBot-core-2.0.0-SNAPSHOT.jar!/META-INF/beans.xml@11 is neither annotated @Interceptor nor registered through a portable extension
    at org.jboss.weld.bootstrap.Validator.validateEnabledInterceptorClasses(Validator.java:466)
    ...

Although the class has @Interceptor (and the same class works fine with the other module).

When I debug WeldBootstrap#startContainer(Environment environment, Deployment deployment),
deployment.beanDeploymentArchive.beanClasses contains the interceptor
("org.jboss.weld.environment.se.jpa.JpaTransactionInterceptor").

I've checked the dependencies and TattleTale report, they all seem fine.

Any ideas what should I look at / try next?

The project is at http://ondrazizka.googlecode.com/svn/trunk/bots/JawaBot/branches/2.0/ To see the error, run mvn dependency:copy-dependencies java -cp ... org.jboss.jawabot.JawaBotApp Or simply run the web module in NetBeans.

Thanks, Ondra

Update: JIRA: https://issues.jboss.org/browse/WELD-940
Also, I found that it might be caused by a bug in Weld's scanning extension, <weld:scan>.

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

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

发布评论

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

评论(1

浮生未歇 2024-11-26 02:47:49

这是由于使用 Weld 的扫描扩展 引起的:

元素包含包通配符,导致两个“包”中的类匹配(在 CDI/Weld 的术语 IIUC 中是 .jar)。

我不确定是否我使用不当或者这是一个错误。
请参阅 JIRA:https://issues.jboss.org/browse/WELD-940

It was caused by using Weld's scanning extension, <weld:scan>:

An <includes> element contained package wildcard which resulted in matching classes in both "packages" (which is .jar in CDI / Weld's terminology IIUC).

I am not sure if I used it improperly or it's a bug.
See JIRA: https://issues.jboss.org/browse/WELD-940

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