0 Replies Latest reply on Apr 18, 2014 5:23 AM by Stephan Pelikan

    Interceptor not called

    Stephan Pelikan Newbie



      I'm using JBoss 7.2.0 and I want to install a bean-method-interceptor for a restful webservice (for logging-purpose). I did all as described in many tutorials, but the interceptor isn't called. If I add an @Interceptors annotation, the interceptor is called.


      My files are



      @Target({ElementType.METHOD, ElementType.TYPE})
      public @interface Logged {



      public class LoggedInterceptor {
          public LoggedInterceptor() {
          public Object logMethodEntry(InvocationContext invocationContext)
                  throws Exception {
              System.out.println("HE Entering method: "
                      + invocationContext.getMethod().getName() + " in class "
                      + invocationContext.getMethod().getDeclaringClass().getName());
              return invocationContext.proceed();



      public class MyRestfulService extends AnyOfBaseClass {
          public GroupedResponse<TariffSelectionResponse> execute(
                  TariffSelectionInput input) {
                // any functionality



      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
              xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" 
              bean-discovery-mode="all" version="1.1">


      The interceptor-method should be invoke on calling the restful service. If I remove the comment in MyRestfulService.java


      it works. But I need loose coupling for testing and reusing.


      Any suggestions? I cannot imagine that this does not work. I'm sure I forgot something but I cannot find it.



      - It is not possible to upgrade to WildFly because I use a commercial library in this project which is not yet ported. So I stick to jboss 7.2.0.

      - Maybe this is relevant: The webservice is part of a war which is packed into an ear.