It wasn't easy to find out how to configure a default interceptor in EJB3 environment.
It's okay to make this snippet into the ejb-jar.xml:
Maybe everybody forget to mention maybe it's a Glassfish V2 trick that I get this error message during deployment:
Interceptor binding contains an interceptor class name = pkg.IC that is not defined as an interceptor
...unless I register the interceptor class itself too with this:
<interceptors> and <assembly-descriptor> are children of <ejb-jar> element in this order as it seems well in the xsd.
It's okay to make this snippet into the ejb-jar.xml:
<assembly-descriptor>
<interceptor-binding>
<ejb-name>*</ejb-name>
<interceptor-class>pkg.IC</interceptor-class>
</interceptor-binding>
</assembly-descriptor>
Maybe everybody forget to mention maybe it's a Glassfish V2 trick that I get this error message during deployment:
Interceptor binding contains an interceptor class name = pkg.IC that is not defined as an interceptor
...unless I register the interceptor class itself too with this:
<interceptors>
<interceptor>
<interceptor-class>pkg.IC</interceptor-class>
<around-invoke>
<method-name>call</method-name>
</around-invoke>
</interceptor>
</interceptors>
<interceptors> and <assembly-descriptor> are children of <ejb-jar> element in this order as it seems well in the xsd.
Comments
I am facing trouble defining default interceptor. my ejb-jar.xml is as follows... but when i deploy my app. in jboss it complains for parsing error. please note that i am using ejb 3.0
com.eks.ias.service.location.service.ExceptionInterceptor
test
*
com.eks.ias.service.location.service.ExceptionInterceptor
I have an sales EJB project which controls the inventory, in and out of stock.
I want to add extra functionality to the EJB, such as payment and billing.
For this I want to use Interceptor in Session Bean class. I want to implement the new functionality as a component, decoupled from the current implementation.
But I have not access to the current session bean or Xml (ejb-jar), so I can not put the @ Interceptor in the class or method! how I can solve my problem?
Can I add @ Interceptor from another location, class or session? There is another way of doing?
Thanks for your help.