1 2 Previous Next 19 Replies Latest reply on Jun 6, 2013 6:08 AM by rhanus

    JBoss AS7 Interceptor in JAR not being invoked by EJB

    shawnfirth

      I have an Enterprise Application Project (EAP) composed of the following:

      EAP ear

                  /lib

                              /common.jar – contains JPA data classes package and interceptor package

                                          /META-INF/beans.xml – specifies the interceptor (JBoss weld throws an exception if the interceptor is not defined in a beans.xml in this jar)

                              /another.jar (does not/will not have or use interceptors)

                              /yet-another.jar (does not/will not have or use interceptors)

       

      EJB jar – contains a Bean that uses the JPA classes and interceptor

                  /META-INF/ejb-jar.xml – specifies interceptor

       

      The Environment

      JDK 1.7.0_21

      MyEclipse for Spring 10.6.0

      Maven4MyEcplise (used to deploy to local JBoss)

      JBoss AS7 EAP 6.1.0 Final

       

      The reason the interceptor is not defined in the EJB is because it will be used across multiple EJBs. Furthermore, the intent is to use the interceptor in the JPA data classes in the common.jar, that will be used by the various EJBs.

       

      The Interceptor Binding Annotation

      import java.lang.annotation.ElementType;

      import java.lang.annotation.Retention;

      import java.lang.annotation.RetentionPolicy;

      import java.lang.annotation.Target;

       

      import javax.interceptor.InterceptorBinding;

       

      @InterceptorBinding

      @Target ({ ElementType.METHOD, ElementType.TYPE })

      @Retention (RetentionPolicy.RUNTIME)

      public @interface WriteControl

      {

      }

       

      The Interceptor

      import javax.interceptor.AroundInvoke;

      import javax.interceptor.Interceptor;

      import javax.interceptor.InvocationContext;

       

      @WriteControl

      @Interceptor

      public class WriteControlInterceptor

      {

            @AroundInvoke

            public Object validateWrite (InvocationContext context) throws Exception

            {

                  System.out.println ("WriteControlInterceptor::validateWrite ");

       

                  Object result = context.proceed ();

       

                  System.out.println ("WriteControlInterceptor::validateWrite End");

       

                  return result;

            }

      }

       

      In The Bean

      @WriteControl

      public void testInterceptor ()

      {

            // do something…

      }

       

      The Problem

      Currently the interceptor is attached to one function in the EJB and in one function in one of the JPA classes in the common.jar. Everything compiles and deploys to JBoss without errors, however, the interceptor is never invoked in the Bean or in the JPA data class. If I remove the beans.xml from the common.jar and put it in the EJB jar I get the following error from JBoss:

      • org.jboss.weld.exceptions.DeploymentException: WELD-001417 Enabled interceptor class <class> com.something.WriteControlInterceptor </class> in vfs:/D:/JEE6/jboss-eap-6.1/standalone/deployments/EAP.ear/ConfigurationEJB-0.0.1-SNAPSHOT.jar/META-INF/beans.xml@6 is neither annotated @Interceptor nor registered through a portable extension

      Putting the beans.xml in both common.jar and ejb.jar, just makes the JBoss weld exception go away, but the interceptor still doesn’t work.

      Putting the beans.xml in the EAP META-INF has no effect.

      Specifying the interceptor in the EJB’s ejb-jar.xml, with or without binding doesn’t seem to do anything either.

       

      The Question

      What configuration/deployment magic am I missing to get JBoss AS7 to allow the EJB to invoke the interceptor?

       

      Any help would be greatly appreciated.

      Thanks...

        • 1. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
          rhanus

          I wouldn't specify interceptor declared using interceptor binding in ejb-jar.xml

          try to add bean.xml into ejb jar, enable the interceptor here and remove it from ejb-jar.xml

          • 2. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
            shawnfirth

            Radim,

            That was one of the permutations I already tried, and just tried again, without any luck.

            I put the beans.xml file in the common.jar/META-INF/beans.xml, and I put the beans.xml file in the EJB.jar/META-INF/beans.xml, and I removed all references to the Interceptor from the ejb-jar.xml file.

            While I get no error messages, the Interceptor is not invoked.

            • 3. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
              rhanus

              I've got a very similar deployment under the same environment (jdk, jboss)

              it works for me fine but I have jpa entities in a separate library which is out of cdi control (it's not good idea to maintain jpa entities as cdi beans because od contextual management of beans)

               

              my deployment:

              • lib/common.jar here are interceptors defined and empty META-INF/bean.xml present
              • ejbjar here a stateless bean uses an interceptor from lib/common.jar and META-INF/bean.xml defines that interceptor
              • 4. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                shawnfirth

                Radim,

                My JPA data classes are in common.jar along with my Interceptors (just in seperate packages).

                I changed my common.jar beans.xml to be blank, and specified the Interceptor in the EJB’s beans.xml., but the Interceptor is still not being invoked.

                Do you have anything in your EJB manifest.mf, like a dependency to the Interceptor package?

                 

                Thanks…

                • 5. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                  rhanus

                  my MANIFEST.MF files are empty

                   

                  it loooks like your bean in ejbjar is not a cdi bean... or you have geneal problem with weld...

                  does your server.log contains following lines ?

                   

                  12:50:10,804 INFO  [org.jboss.weld.deployer] (MSC service thread 1-13) JBAS016002: Processing weld deployment test.ear

                  12:50:10,837 INFO  [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016002: Processing weld deployment logic.jar

                  12:50:10,927 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016005: Starting Services for CDI deployment: test.ear

                  12:50:10,978 INFO  [org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900 1.1.13 (redhat)

                  12:50:10,997 INFO  [org.jboss.weld.deployer] (MSC service thread 1-13) JBAS016008: Starting weld service for deployment test.ear

                   

                  test.ear:

                  - META-INF/application.xml

                  - /lib/common.jar

                  - logic.jar (ejbjar)

                  • 6. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                    shawnfirth

                    Radim,

                    Below is output from when I deploy the EAR to JBoss. The EJB is singleton which starts and does work. The EJB function and the JPA function, which are both wrapped with the Interceptor both fire, however, the Interceptor does not fire for either.


                    08:44:29,500 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found MyEAP.ear in deployment directory. To trigger deployment create a file called MyEAP.ear.dodeploy

                    08:44:29,505 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "MyEAP.ear" (runtime-name: "MyEAP.ear")

                    08:44:30,785 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "null" (runtime-name: "MyEJB-0.0.1-SNAPSHOT.jar")

                    08:44:30,797 INFO  [org.jboss.as.jpa] (MSC service thread 1-11) JBAS011401: Read persistence.xml for MyJPA

                    08:44:30,821 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment MyEAP.ear

                    08:44:30,834 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016002: Processing weld deployment MyEJB-0.0.1-SNAPSHOT.jar

                    08:44:30,834 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-6) JNDI bindings for session bean named Bean in deployment unit subdeployment "MyEJB-0.0.1-SNAPSHOT.jar" of deployment "MyEAP.ear" are as follows:

                     

                          java:global/MyEAP/MyEJB-0.0.1-SNAPSHOT/Bean!com.something.Bean

                          java:app/MyEJB-0.0.1-SNAPSHOT/Bean!com.something.Bean

                          java:module/Bean!com.something.Bean

                          java:global/MyEAP/MyEJB-0.0.1-SNAPSHOT/Bean

                          java:app/MyEJB-0.0.1-SNAPSHOT/Bean

                          java:module/Bean

                     

                    08:44:30,838 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016005: Starting Services for CDI deployment: MyEAP.ear

                    08:44:30,841 INFO  [org.jboss.weld.deployer] (MSC service thread 1-16) JBAS016008: Starting weld service for deployment MyEAP.ear

                    08:44:30,841 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 90) JBAS011402: Starting Persistence Unit Service 'MyEAP.ear#MyJPA'

                     

                    MyEAP.ear

                    - META-INF/application.xml (references MyEJB.jar)

                    - lib/common.jar (META-INF/beans.xml – empty)

                    - MyEJB.jar (META-INF/beans.xml – specifies Interceptor)

                     

                    Thanks...

                    • 7. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                      rhanus

                      decrease logging level of org.jboss.weld to DEBUG and you should find in server.log something like following:

                       

                      15:08:36,891 DEBUG [org.jboss.weld.deployer] (MSC service thread 1-5) Found beans.xml: "/D:/jboss/jboss-eap-6.1/content/test.ear/lib/common.jar/META-INF/beans.xml"

                      15:08:36,974 DEBUG [org.jboss.weld.deployer] (MSC service thread 1-3) Found beans.xml: "/D:/jboss/jboss-eap-6.1/content/test.ear/logic.jar/META-INF/beans.xml"

                      15:08:38,844 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-1) WELD-000107 Interceptor: Interceptor [class org.cditest.interceptor.LoggingInterceptor intercepts @Logging]

                      15:08:38,922 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-1) WELD-000106 Bean: Session bean [class org.cditest.logic.StartUpBean with qualifiers [@Any @Default]; local interfaces are [StartUpBean]

                      15:08:39,373 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-1) WELD-000100 Weld initialized. Validating beans

                      15:08:39,454 TRACE [org.cditest.interceptor.LoggingInterceptor] (ServerService Thread Pool -- 48) StartUpBean@418ed612.@PostConstruct

                       

                      @Logging and LoggingInterceptor are defined in common.jar

                      StartUpBean is @Singleton and @Startup ejb bean annotated by Logging interceptor to log lifecycle callbacks (last line of server.log snippet)

                      • 8. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                        shawnfirth

                        Radim,

                        From the org.jboss.weld debug JBoss is finding the beans.xml, and the Interceptor declaration, but not finding the actual Interceptor.

                         

                        09:47:24,567 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found MyEAP.ear in deployment directory. To trigger deployment create a file called MyEAP.ear.dodeploy

                        09:47:29,625 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-9) JBAS015876: Starting deployment of "MyEAP.ear" (runtime-name: "MyEAP.ear")

                        09:47:31,217 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "null" (runtime-name: "MyEJB-0.0.1-SNAPSHOT.jar")

                        09:47:31,240 DEBUG [org.jboss.weld.deployer] (MSC service thread 1-8) Found beans.xml: "/D:/JEE6/jboss-eap-6.1/standalone/deployments/MyEAP.ear/lib/common.jar/META-INF/beans.xml"

                        09:47:31,452 INFO  [org.jboss.as.jpa] (MSC service thread 1-8) JBAS011401: Read persistence.xml for MyJPA

                        09:47:31,505 DEBUG [org.jboss.weld.deployer] (MSC service thread 1-15) Found beans.xml: "/D:/JEE6/jboss-eap-6.1/standalone/deployments/MyEAP.ear/MyEJB-0.0.1-SNAPSHOT.jar/META-INF/beans.xml"

                        09:47:31,564 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016002: Processing weld deployment MyEAP.ear

                        09:47:31,627 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016002: Processing weld deployment MyEJB-0.0.1-SNAPSHOT.jar

                        09:47:31,630 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named Bean in deployment unit subdeployment "MyEJB-0.0.1-SNAPSHOT.jar" of deployment "MyEAP.ear" are as follows:

                         

                              java:global/MyEAP/MyEJB-0.0.1-SNAPSHOT/Bean!com.something.Bean

                              java:app/MyEJB-0.0.1-SNAPSHOT/Bean!com.something.Bean

                              java:module/Bean!com.something.Bean

                              java:global/MyEAP/MyEJB-0.0.1-SNAPSHOT/Bean

                              java:app/MyEJB-0.0.1-SNAPSHOT/Bean

                              java:module/Bean

                         

                        09:47:31,660 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016005: Starting Services for CDI deployment: MyEAP.ear

                        09:47:31,744 INFO  [org.jboss.weld.Version] (MSC service thread 1-4) WELD-000900 1.1.13 (redhat)

                        09:47:31,768 INFO  [org.jboss.weld.deployer] (MSC service thread 1-12) JBAS016008: Starting weld service for deployment MyEAP.ear

                        09:47:31,770 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 48) JBAS011402: Starting Persistence Unit Service 'MyEAP.ear#MyJPA'

                        09:47:32,110 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000103 Enabled alternatives for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : [] []

                        09:47:32,111 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000104 Enabled decorator types for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : []

                        09:47:32,112 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000105 Enabled interceptor types for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : [<class>com.something.data.security.MyInterceptor</class> in vfs:/D:/JEE6/jboss-eap-6.1/standalone/deployments/MyEAP.ear/MyEJB-0.0.1-SNAPSHOT.jar/META-INF/beans.xml@6]

                        09:47:32,127 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000103 Enabled alternatives for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : [] []

                        09:47:32,127 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000104 Enabled decorator types for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : []

                        09:47:32,127 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000105 Enabled interceptor types for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : []

                        09:47:32,129 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000103 Enabled alternatives for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : [] []

                        09:47:32,129 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000104 Enabled decorator types for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : []

                        09:47:32,130 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000105 Enabled interceptor types for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : []

                        09:47:32,131 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000103 Enabled alternatives for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : [] []

                        09:47:32,131 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000104 Enabled decorator types for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : []

                        09:47:32,132 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-12) WELD-000105 Enabled interceptor types for Manager

                        Enabled alternatives: [] []

                        Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                        Registered beans: 0

                        : []

                        09:47:32,132 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 48) HCANN000001: Hibernate Commons Annotations {4.0.1.Final-redhat-2}

                        09:47:32,140 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 48) HHH000412: Hibernate Core {4.2.0.Final-redhat-1}

                        09:47:32,142 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 48) HHH000206: hibernate.properties not found

                        09:47:32,145 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 48) HHH000021: Bytecode provider name : javassist

                        09:47:32,168 INFO  [org.hibernate.ejb.Ejb3Configuration] (ServerService Thread Pool -- 48) HHH000204: Processing PersistenceUnitInfo [

                              name: MyJPA

                              ...]

                         

                        Any ideas what might be causing this?

                        Thanks…

                        • 9. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                          rhanus

                          doublecheck your interceptor binding type and interceptor type

                          weld is not recognizing your interceptor

                          • 10. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                            shawnfirth

                            Radim,

                            Below is the code for the Interceptor binding,  interceptor, and bean. The Interceptor binding annotation and the interceptor are defined in the same package in common.jar. If I removed either ElementType.METHOD or ElementType.TYPE MyEclipse gives me errors either on Interceptor or the Bean. This is the first time I’ve tried to build an Interceptor…so what am I missing?

                             

                            The Interceptor Binding Annotation – declared in common.jar

                            import java.lang.annotation.ElementType;

                            import java.lang.annotation.Retention;

                            import java.lang.annotation.RetentionPolicy;

                            import java.lang.annotation.Target;

                             

                            import javax.interceptor.InterceptorBinding;

                             

                            @InterceptorBinding

                            @Target ({ ElementType.METHOD, ElementType.TYPE })

                            @Retention (RetentionPolicy.RUNTIME)

                            public @interface WriteControl{}

                             

                            The Interceptor – declared in common.jar

                            import javax.interceptor.AroundInvoke;

                            import javax.interceptor.Interceptor;

                            import javax.interceptor.InvocationContext;

                             

                            @WriteControl @Interceptor

                            public class WriteControlInterceptor

                            {

                                  @AroundInvoke

                                  public Object validateWrite (InvocationContext context) throws Exception

                                  {

                            System.out.println ("WriteControlInterceptor::validateWrite ");

                             

                                        Object result = context.proceed ();

                             

                            System.out.println ("WriteControlInterceptor::validateWrite End");

                             

                                        return result;

                                  }

                            }

                             

                            In The Bean

                             

                            import java.io.File;

                            import java.math.BigDecimal;

                            import java.sql.Connection;

                            import java.sql.SQLException;

                            import java.util.HashMap;

                            import java.util.logging.Level;

                            import java.util.logging.Logger;

                             

                            import javax.annotation.PostConstruct;

                            import javax.annotation.PreDestroy;

                            import javax.annotation.Resource;

                            import javax.ejb.Singleton;

                            import javax.ejb.Startup;

                            import javax.naming.InitialContext;

                            import javax.naming.NamingException;

                            import javax.persistence.EntityManager;

                            import javax.persistence.EntityManagerFactory;

                            import javax.persistence.Persistence;

                            import javax.sql.DataSource;

                            import javax.xml.bind.JAXBContext;

                             

                            import com.something.data.security.WriteControl;

                             

                            @Startup

                            @Singleton

                            public class Bean

                            {

                             

                            @WriteControl

                            public void testInterceptor ()

                            {

                            // do something…

                            }

                            }

                             

                            Thanks…

                            • 11. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                              rhanus

                              my code is exactly the same with exception of interceptor implementing Serializable...

                              • 12. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                                shawnfirth

                                Radim,

                                While it seems that weld is finding the Interceptor, it still will not invoke on the bean’s function, or on the JPA data class function. I don’t need it to invoke on the bean function…I really want it to invoke on specific JPA data class’s functions. For as simple as this is supposed to be, it refuses to work.

                                 

                                13:54:14,103 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-1) WELD-000105 Enabled interceptor types for Manager

                                Enabled alternatives: [] []

                                Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                                Registered beans: 0

                                : [<class>com.something.data.security.MyInterceptor</class> in vfs:/D:/JEE6/jboss-eap-6.1/standalone/deployments/MyEAP.ear/MyEJB-0.0.1-SNAPSHOT.jar/META-INF/beans.xml@6]

                                13:54:14,104 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-1) WELD-000103 Enabled alternatives for Manager

                                Enabled alternatives: [] []

                                Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                                Registered beans: 0

                                : [] []

                                13:54:14,104 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-1) WELD-000104 Enabled decorator types for Manager

                                Enabled alternatives: [] []

                                Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                                Registered beans: 0

                                : []

                                13:54:14,105 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-1) WELD-000105 Enabled interceptor types for Manager

                                Enabled alternatives: [] []

                                Registered contexts: [interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.inject.Singleton, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.SessionScoped]

                                Registered beans: 0

                                : [<class>com.something.data.security.MyInterceptor</class> in vfs:/D:/JEE6/jboss-eap-6.1/standalone/deployments/MyEAP.ear/lib/common.jar/META-INF/beans.xml@6]

                                13:54:15,778 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (ServerService Thread Pool -- 73) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider

                                13:54:15,868 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 73) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect

                                13:54:15,870 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (ServerService Thread Pool -- 73) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

                                13:54:15,870 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 73) HHH000397: Using ASTQueryTranslatorFactory

                                13:54:16,429 WARN [org.hibernate.internal.SessionFactoryImpl] (ServerService Thread Pool -- 73) HHH000008: JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()

                                13:54:16,599 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-14) WELD-000107 Interceptor: Interceptor [class com.something.data.security.MyInterceptor intercepts @WriteControl]

                                 

                                Thank you for your time…

                                • 13. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                                  nickarls

                                  Just skimmed through the post but I wouldn't bet that CDI interceptors are bound to singletons/entities. What happens if you try it on an @ApplicationScoped bean? (and make sure you have beans.xml files with enabled interceptors about everywhere, BDAs are a bit tricky)

                                  • 14. Re: JBoss AS7 Interceptor in JAR not being invoked by EJB
                                    rhanus

                                    I don't see any reason why it doesn't work for you

                                    I may send to you a simple ear deployment with sources to check if it works in your environment

                                    1 2 Previous Next