1 Reply Latest reply on Jul 15, 2010 9:43 AM by jaikiran

    Default Interceptor Not called

    bhavsar.er

      Hi,

      I am having trouble calling default interceptor using ejb-jar.xml. When i use the same using class level interceptor @interceptors it works.

      Please let me know where i am doing wrong.

      Thanks.

       

      =======ejb-jar.xml==========

       

      <?xml version="1.0" encoding="UTF-8"?>

      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

                   http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"

          version="3.0">

       

          <interceptors>

              <interceptor>

                  <interceptor-class>com.eks.ias.service.location.service.ExceptionInterceptor</interceptor-class>

                  <around-invoke>

                      <method-name>test</method-name>

                  </around-invoke>

              </interceptor>

          </interceptors>

       

       

          <assembly-descriptor>

       

              <!--

       

                  Default interceptor that will apply to all methods for all beans in

       

                  deployment

       

              -->

       

              <interceptor-binding>

       

                  <ejb-name>*</ejb-name>

       

                  <interceptor-class>com.eks.ias.service.location.service.ExceptionInterceptor</interceptor-class>

       

                  <method>

       

                      <method-name>test</method-name>

       

                  </method>

       

              </interceptor-binding>

       

          </assembly-descriptor>

       

      </ejb-jar>

        • 1. Re: Default Interceptor Not called
          jaikiran

          paresh bhavsar wrote:

           


                  <interceptor-binding>

           

                      <ejb-name>*</ejb-name>

           

                      <interceptor-class>com.eks.ias.service.location.service.ExceptionInterceptor</interceptor-class>

           

                      <method>

           

                          <method-name>test</method-name>

           

                      </method>

           

                  </interceptor-binding>

           

           

          As per the spec:

           

          3. 
                  <interceptor-binding>
                  <ejb-name>EJBNAME</ejb-name>
                  <interceptor-class>INTERCEPTOR</interceptor-class>
                  <method>
                  <method-name>METHOD</method-name>
                  </method>
                  </interceptor-binding>
                  
                  This style is used to associate a method-level interceptor with 
                  the specified enterprise bean.  If there are multiple methods
                  with the same overloaded name, the element of this style refers
                  to all the methods with the overloaded name.  Method-level
                  interceptors can only be associated with business methods of the
                  bean class.   Note that the wildcard value "*" cannot be used
                  to specify method-level interceptors.

           

          See the note in the above section (which for some reason isn't showing up as bold even after marking it as bold through the forum editor).