The default "ejb-name" of an EJB in ejb-jar.xml
Issue
I have an Interceptor class, I need to bind it with an EJB.
I can use annotation @Interceptors to bind it in EJB class, however when I try to do the same in ejb-jar.xml configuration file, it fails with exception.
The Interceptor class looks like:
@Interceptor
public class SampleInterceptor implements Serializable {
******;
}
I have no problem to use this Interceptor with @Interceptors annotation like this:
@Interceptors(value = SampleInterceptor.class)
public class SampleEjb{
******;
}
But when I try this in my ejb-jar.xml:
<interceptor-binding>
<ejb-name>com.test.ejb.SampleEjb</ejb-name>
<interceptor-class>com.test.interceptor.SampleInterceptor</interceptor-class>
</interceptor-binding>
I have this exception:
org.jboss.weld.exceptions.DeploymentException: WELD-000069 An interceptor must have at least one binding, but com.test.interceptor.SampleInterceptor has none
at org.jboss.as.weld.services.WeldService.start(WeldService.java:83)
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
