1 Reply Latest reply on Apr 24, 2014 4:36 AM by Wolf-Dieter Fink

    Using interceptor from another deployed module

    Samuli Saarinen Newbie



      On Wildfly 8.1.CR1 I'm trying to use Interceptor that is part of another deployment (ejb module within an ear) and use it on and ejb that is being deployed as separate war (not part of the ear). I have arquillian test that try to simulate the situation. I'll post relevant parts of the code below to show the situation better.


      Interceptor is as follows:

      public class ProfilingInterceptor {
          public static int postConstructs;
          public void aroundPostConstruct(final InvocationContext invocation) {


      EJB that should be intercepted

      @Singleton @Startup
      public class DummyService {
          public void init() {


      Arquillian deployment

      @Deployment(name = "app", order = 1, testable = false)
      public static Archive<?> createDependencyEar() {
          JavaArchive javaArchive = ShrinkWrap
                  .create(JavaArchive.class, "dep.jar")
          EnterpriseArchive archive = ShrinkWrap.create(EnterpriseArchive.class,
          return archive;
      @Deployment(name = "test", order = 2)
      public static Archive<?> createDeployment5() {
          WebArchive archive = ShrinkWrap.create(WebArchive.class, "test2.war")
                  .addAsWebInfResource("ejb-jar.xml", "ejb-jar.xml")
          return archive;



      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar 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/ejb-jar_3_2.xsd"



      <?xml version='1.0' encoding='UTF-8'?>
      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
                  <module name="deployment.app.ear.dep.jar" export="true" />


      I have tried to use jandex as described in some other questions but so far no luck. Also I can specify annotations="true" for the dependent module but that makes the deployment fail. and meta-inf="import" or "export" makes no difference. Only way I can get it to work is if I define the post-construct method in the ejb-jar.xml like so



      This leads me to the conclusion that the annotations are not being picked up from the interceptor. Is there anyone that might have this working and could guide me to the right direction?