开发者

CDI stops working when using weld-se-core and weld-servlet-core?

开发者 https://www.devze.com 2023-03-19 12:29 出处:网络
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

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 开发者_StackOverflow中文版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>.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号