Esteban Rincon
Esteban Rincon

Reputation: 2110

CDI definition failure:WELD-001476: Interceptor [class] must be @Dependent

I'm trying out the APM MoSKito and been trying to deploy the embedded Web UI that will be mapped to [context]/mui/* where the MoSKito interface will be shown.

The problem is that I get the following error when deploying app:

CDI definition failure:WELD-001476: Interceptor [class net.anotheria.moskito.integration.cdi.CountInterceptor intercepts @Count] must be @Dependent

The interceptors are declared in the beans.xml:

<interceptors>
    <class>net.anotheria.moskito.integration.cdi.CountInterceptor</class>
    <class>net.anotheria.moskito.integration.cdi.CallInterceptor</class>
</interceptors>   

But since I'm not able to modify the Maven repositories for this APM, I can't really make These classes use the @Dependent annotation so I don't really understand the problem, I would really apreciate some help. Thanks!

Upvotes: 0

Views: 787

Answers (1)

Siliarus
Siliarus

Reputation: 6753

The problem is that MoSKito in versions lower than 2.7.0 has the @Singleton annotation on their interceptors. That doesn't pass Weld validation (interceptors have to be @Dependent beans) and causes the described exception.

The solution is therefore to upgrade the framework to 2.7.0+.As a result of this, an update to beans.xml is needed as the package names of interceptors changed as well.

Upvotes: 1

Related Questions