1 2 Previous Next 15 Replies Latest reply on Dec 15, 2006 7:42 PM by fabiocsilva

    probleam in granularity of interception

    fabiocsilva

      I am needing to intercept the call of a constructor in my application.
      When the instantiation occurs within of a method called for the system executes correctly. However, the instantiation occurs, in fact, inside of a constructor of another object. This another object is singleton. In this case the pointcut is not running. What it can be?

      
      Running:
      
      public class ServletInit extends HttpServlet {
      
       public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       EmployeeRecord er = new EmployeeRecord(null);
       ...
       }
      }
      
      



      ERROR:
      
      
      public class ServletInit extends HttpServlet {
      
       public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       HealthWatcherFacade.getInstance();
       ...
       }
      }
      
      
      
      public class HealthWatcherFacade {
       private static HealthWatcherFacade singleton; //padrao singleton
       private ComplaintRecord complaintRecord;
       private HealthUnitRecord healthUnitRecord;
       private MedicalSpecialtyRecord specialtyRecord;
       private DiseaseRecord diseaseRecord;
       private EmployeeRecord employeeRecord;
      
       private HealthWatcherFacade() {
       complaintRecord = new ComplaintRecord(null);
       healthUnitRecord = new HealthUnitRecord(null);
       specialtyRecord = new MedicalSpecialtyRecord(null);
       diseaseRecord = new DiseaseRecord(null);
       employeeRecord = new EmployeeRecord(null);
       }
       public synchronized static HealthWatcherFacade getInstance() {
       if (singleton == null) {
       singleton = new HealthWatcherFacade();
       }
      
       return singleton;
       }
      ...
      }
      
      


        • 1. Re: problem in granularity of interception
          fabiocsilva

           

          "fabiocsilva" wrote:
          I am needing to intercept the call of a constructor in my application.
          When the instantiation occurs within of a method called for the system executes correctly. However, the instantiation occurs, in fact, inside of a constructor of another object. This another object is singleton. In this case the pointcut is not running. What it can be?
          
          Running:
          
          public class ServletInit extends HttpServlet {
          
           public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
           EmployeeRecord er = new EmployeeRecord(null);
           ...
           }
          }
          
          



          ERROR:
          
          
          public class ServletInit extends HttpServlet {
          
           public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
           HealthWatcherFacade.getInstance();
           ...
           }
          }
          
          
          
          public class HealthWatcherFacade {
           private static HealthWatcherFacade singleton; //padrao singleton
           private ComplaintRecord complaintRecord;
           private HealthUnitRecord healthUnitRecord;
           private MedicalSpecialtyRecord specialtyRecord;
           private DiseaseRecord diseaseRecord;
           private EmployeeRecord employeeRecord;
          
           private HealthWatcherFacade() {
           complaintRecord = new ComplaintRecord(null);
           healthUnitRecord = new HealthUnitRecord(null);
           specialtyRecord = new MedicalSpecialtyRecord(null);
           diseaseRecord = new DiseaseRecord(null);
           employeeRecord = new EmployeeRecord(null);
           }
           public synchronized static HealthWatcherFacade getInstance() {
           if (singleton == null) {
           singleton = new HealthWatcherFacade();
           }
          
           return singleton;
           }
          ...
          }
          
          


          • 2. Re: probleam in granularity of interception
            flavia.rainone.old

            I have no clue on what is going on with your example.
            Could you please send me your jboss-aop.xml file, and tell me the weaving mode you are using (aopc compiler, loadtime weaving or hotswap)?

            • 3. Re: probleam in granularity of interception
              fabiocsilva

              Weaving mode: compile-time

              jboss-aop.xml:

              
              
              <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
              <aop>
              
               <aspect class="aspects.distribution.HealthWatcherServerSideAspect"
               scope="PER_VM" />
              
               <aspect class="aspects.distribution.HealthWatcherClientSideAspect"
               scope="PER_VM" />
              
              
              
               <aspect class="aspects.dataManagement.nonpersistent.DataCollectionNonPersistent"
               scope="PER_VM" />
              
              
              <!--
               <aspect class="aspects.dataManagement.persistent.DataCollectionPersistent"
               scope="PER_VM" />
              -->
              
              
               <aspect class="aspects.dataManagement.persistent.PersistenceControlHealthWatcher"
               scope="PER_VM" />
              
              
               <introduction
               expr="class(complaint.ComplaintRecord)
               OR class(healthGuide.HealthUnitRecord)
               OR class(healthGuide.MedicalSpecialtyRecord)
               OR class(employee.EmployeeRecord)
               OR class(complaint.DiseaseRecord)">
               <mixin>
               <interfaces>
               aspects.dataManagement.util.SystemRecord
               </interfaces>
               <class>aspects.dataManagement.util.SystemRecordImpl</class>
               <construction>
               new aspects.dataManagement.util.SystemRecordImpl()
               </construction>
               </mixin>
               </introduction>
              
              
               <pointcut
               expr="execution(public void gui.servlets.ServletWebServer->init(javax.servlet.ServletConfig))"
               name="facadeMainExecution" />
              
               <bind pointcut="facadeMainExecution">
               <advice
               aspect="aspects.distribution.HealthWatcherServerSideAspect"
               name="beforeFacadeMainExecution" />
               </bind>
              
              
               <pointcut name="facadeCallers"
               expr="within($instanceof{javax.servlet.http.HttpServlet})" />
              
              
               <pointcut name="facadeCalls"
               expr="call(* controllers.HealthWatcherFacade->*(..)) AND !call(static * controllers.HealthWatcherFacade->*(..))" />
              
              
              
               <bind pointcut="facadeCallers AND facadeCalls">
               <advice
               aspect="aspects.distribution.HealthWatcherClientSideAspect"
               name="aroundFacadeLocalCalls" />
               </bind>
              
              <!--
               <pointcut name="recordsCreation"
               expr="all($instanceof{aspects.dataManagement.util.SystemRecord}) AND !within($instanceof{aspects.dataManagement.AbstractDataCollectionCustomization})" />
              -->
              
               <pointcut name="recordsCreation"
               expr="call(employee.EmployeeRecord->new(..))" />
              
               <bind pointcut="recordsCreation">
               <advice
               aspect="aspects.dataManagement.nonpersistent.DataCollectionNonPersistent"
               name="aroundRecordsCreation" />
              <!--
               <advice
               aspect="aspects.dataManagement.persistent.DataCollectionPersistent"
               name="aroundRecordsCreation" />
              -->
               </bind>
              
              
              
               <pointcut name="connectionOperations" expr="call(void IPersistenceMechanism->connect()) OR
               call(void IPersistenceMechanism->disconnect())" />
              
              
              
              
              
              
               <pointcut name="obtainPmInstance"
               expr="call(* aspects.dataManagement.dataCollections.rdbms.PersistenceMechanismRDBMS->getInstance(..))" />
              
              
              
               <pointcut name="initSystem"
               expr="call(controllers.HealthWatcherFacade->new())" />
              
               <bind pointcut="initSystem">
               <advice
               aspect="aspects.dataManagement.persistent.PersistenceControlHealthWatcher"
               name="adviceInitSystem" />
               </bind>
              
              
              
              </aop>
              
              
              



              ServletInit.java
              
              
              package gui.servlets;
              
              
              
              import java.io.IOException;
              
              
              
              import javax.servlet.ServletConfig;
              
              import javax.servlet.ServletException;
              
              import javax.servlet.http.HttpServlet;
              
              import javax.servlet.http.HttpServletRequest;
              
              import javax.servlet.http.HttpServletResponse;
              
              
              
              import controllers.HealthWatcherFacade;
              
              import employee.EmployeeRecord;
              
              
              public class ServletInit extends HttpServlet {
              
              
              
              
              
              
              
              
              
              
              
               public void init(ServletConfig config) throws ServletException {
              
               HealthWatcherFacade.getInstance();
              
              
              
               }
              
              
              
               public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              
               HealthWatcherFacade.getInstance();
              
              
              
               }
              
              
              
               public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              
               HealthWatcherFacade.getInstance();
              
               }
              
              }
              
              





              HealthWatcherFacade.java
              
              
              package controllers;
              
              
              
              import complaint.*;
              
              import employee.Employee;
              
              import employee.EmployeeRecord;
              
              import exceptions.ObjectAlreadyInsertedException;
              
              import exceptions.ObjectNotFoundException;
              
              import exceptions.ObjectNotValidException;
              
              import healthGuide.HealthUnit;
              
              import healthGuide.HealthUnitRecord;
              
              import healthGuide.MedicalSpecialtyRecord;
              
              import util.IteratorHW;
              
              
              
              
              
              public class HealthWatcherFacade {
              
              
              
               private static HealthWatcherFacade singleton;
              
               private ComplaintRecord complaintRecord;
              
               private HealthUnitRecord healthUnitRecord;
              
               private MedicalSpecialtyRecord specialtyRecord;
              
               private DiseaseRecord diseaseRecord;
              
               private EmployeeRecord employeeRecord;
              
              
              
               private HealthWatcherFacade() {
              
               complaintRecord = new ComplaintRecord(null);
              
               healthUnitRecord = new HealthUnitRecord(null);
              
               specialtyRecord = new MedicalSpecialtyRecord(null);
              
               diseaseRecord = new DiseaseRecord(null);
              
               employeeRecord = new EmployeeRecord(null);
              
               }
              
               public synchronized static HealthWatcherFacade getInstance() {
              
               if (singleton == null) {
              
               singleton = new HealthWatcherFacade();
              
               }
              
              
              
               return singleton;
              
               }
              
              
              
               public Employee searchEmployee(String login) throws ObjectNotFoundException {
              
               return employeeRecord.search(login);
              
               }
              
               public void update(Employee employee) throws ObjectNotFoundException, ObjectNotValidException {
              
               employeeRecord.update(employee);
              
               }
              
               public void insert(Employee employee) throws ObjectAlreadyInsertedException, ObjectNotValidException {
              
               employeeRecord.insert(employee);
              
               }
              
              
              
               public int insert(Complaint complaint) throws ObjectAlreadyInsertedException, ObjectNotValidException {
              
               return complaintRecord.insert(complaint);
              
               }
              
               public void update(Complaint complaint) throws ObjectNotFoundException, ObjectNotValidException {
              
               complaintRecord.update(complaint);
              
               }
              
               public Complaint searchComplaint(int complaintCode) throws ObjectNotFoundException {
              
               return complaintRecord.search(complaintCode);
              
               }
              
               public void update(HealthUnit unit) throws ObjectNotFoundException, ObjectNotValidException {
              
               healthUnitRecord.update(unit);
              
               }
              
               public HealthUnit searchHealthUnit(int healthUnitCode) throws ObjectNotFoundException {
              
               return healthUnitRecord.search(healthUnitCode);
              
               }
              
               public IteratorHW searchHealthUnitsBySpecialty(int specialtyCode) throws ObjectNotFoundException {
              
               return healthUnitRecord.searchHealthUnitsBySpecialty(specialtyCode);
              
               }
              
               public IteratorHW getHealthUnitList() throws ObjectNotFoundException {
              
               return healthUnitRecord.getHealthUnitList();
              
               }
              
               public IteratorHW searchSpecialtiesByHealthUnit(int healthUnitCode) throws ObjectNotFoundException {
              
               return healthUnitRecord.searchSpecialtiesByHealthUnit(healthUnitCode);
              
               }
              
               public IteratorHW getComplaintList() throws ObjectNotFoundException {
              
               return complaintRecord.getComplaintList();
              
               }
              
               public IteratorHW getSpecialtyList() throws ObjectNotFoundException {
              
               return specialtyRecord.getSpecialtyList();
              
               }
              
               public DiseaseType searchDiseaseType(int diseaseCode) throws ObjectNotFoundException {
              
               return diseaseRecord.search(diseaseCode);
              
               }
              
               public IteratorHW getDiseaseTypeList() throws ObjectNotFoundException {
              
               return diseaseRecord.getDiseaseTypeList();
              
               }
              
              }
              
              
              




              EmployeeRecord.java
              
              
              package employee;
              
              
              
              import exceptions.ExceptionMessages;
              
              import exceptions.ObjectAlreadyInsertedException;
              
              import exceptions.ObjectNotFoundException;
              
              import exceptions.ObjectNotValidException;
              
              public class EmployeeRecord implements util.RecordTag{
              
              
              
               private IEmployeeRepository employeeRepository;
              
              
              
               public EmployeeRecord(IEmployeeRepository rep) {
              
               this.employeeRepository = rep;
              
               }
              
              
              
               public Employee search(String login) throws ObjectNotFoundException {
              
               return employeeRepository.search(login);
              
               }
              
              
              
               public void insert(Employee employee) throws ObjectAlreadyInsertedException, ObjectNotValidException {
              
               if (employeeRepository.exists(employee.getLogin())) {
              
               throw new ObjectAlreadyInsertedException(ExceptionMessages.EXC_JA_EXISTE);
              
               } else {
              
               employeeRepository.insert(employee);
              
               }
              
               }
              
              
              
               public void update(Employee employee) throws ObjectNotFoundException, ObjectNotValidException {
              
               employeeRepository.update(employee);
              
               }
              
              }
              


              message when new EmployeeRecord(null) is called inside servlet:
              23:12:45,341 INFO [STDOUT] aroundRecordsCreation:class gui.servlets.ServletInit_1_ConByMInvocation
              23:12:45,369 INFO [STDOUT] aroundRecordsCreation:class gui.servlets.ServletInit_3_ConByMInvocation
              



              When the method HealthWatcherFacade.getInstance() is called the attribute modified in the constructor of EmployeeRecord is intercepted(I used keyword ?all? to discover this interception):

              private IEmployeeRepository employeeRepository;

              public EmployeeRecord(IEmployeeRepository rep) {

              this.employeeRepository = rep;

              }

              • 4. Re: probleam in granularity of interception
                fabiocsilva

                essage of log when using keyword all

                aroundRecordsCreation:class employee.EmployeeRecord$employeeRepository_Set
                


                • 5. Re: probleam in granularity of interception
                  fabiocsilva

                  Somebody has some suggestion?

                  • 6. Re: probleam in granularity of interception
                    flavia.rainone.old

                    Which version of JBoss AOP are you using?

                    • 7. Re: probleam in granularity of interception
                      fabiocsilva

                      JBoss Application Server: 4.05 GA
                      JBoss AOP:1.5.2

                      The standalone mode run correctly. I make tests using a class with the method main. The problem only occurs when the system is in application server.

                      • 8. Re: probleam in granularity of interception
                        flavia.rainone.old

                        Thanks for the info.

                        • 9. Re: probleam in granularity of interception
                          fabiocsilva

                          I changed the way of packaging, with loadtime weaving activated, without success. The instantiations are not intercepted if they occur of indirect way.
                          I already tried to use keywords execution, call and construction.

                          What it can be happening?

                          • 10. Re: probleam in granularity of interception
                            fabiocsilva


                            I changed file jboss-aop.xml. The shown error is abnormal because the class is present in jar of the WEB-INF/lib directory.

                             <aspect class="aspects.dataManagement.nonpersistent.DataCollectionNonPersistent" scope="PER_VM" />
                            
                            
                             <pointcut name="recordsCreation" expr="execution(*->new(..))" />
                            
                            
                             <bind pointcut="recordsCreation">
                             <advice aspect="aspects.dataManagement.nonpersistent.DataCollectionNonPersistent" name="aroundRecordsCreation" />
                             </bind>
                            



                            Result:


                            11:10:00,068 ERROR [STDERR] [warn] AOP Instrumentor failed to transform aspects.dataManagement.nonpersistent.DataCollectionNonPersistent
                            11:10:00,080 ERROR [STDERR] java.lang.RuntimeException: javassist.NotFoundException: healthGuide.IHealthUnitRepository
                            11:10:00,081 ERROR [STDERR] at org.jboss.aop.pointcut.FieldMatcher.visit(FieldMatcher.java:113)
                            11:10:00,081 ERROR [STDERR] at org.jboss.aop.pointcut.ast.ASTField.jjtAccept(ASTField.java:43)
                            11:10:00,081 ERROR [STDERR] at org.jboss.aop.pointcut.Util.has(Util.java:464)
                            11:10:00,082 ERROR [STDERR] at org.jboss.aop.pointcut.Util.has(Util.java:453)
                            11:10:00,082 ERROR [STDERR] at org.jboss.aop.pointcut.ExecutionConstructorMatcher.visit(ExecutionConstructorMatcher.java:95)
                            11:10:00,082 ERROR [STDERR] at org.jboss.aop.pointcut.ast.ASTHasField.jjtAccept(ASTHasField.java:37)
                            11:10:00,082 ERROR [STDERR] at org.jboss.aop.pointcut.MatcherHelper.visit(MatcherHelper.java:127)
                            11:10:00,082 ERROR [STDERR] at org.jboss.aop.pointcut.ast.ASTAnd.jjtAccept(ASTAnd.java:37)
                            11:10:00,082 ERROR [STDERR] at org.jboss.aop.pointcut.MatcherHelper.visit(MatcherHelper.java:118)
                            11:10:00,082 ERROR [STDERR] at org.jboss.aop.pointcut.ast.ASTSub.jjtAccept(ASTSub.java:37)
                            11:10:00,083 ERROR [STDERR] at org.jboss.aop.pointcut.MatcherHelper.visit(MatcherHelper.java:98)
                            11:10:00,083 ERROR [STDERR] at org.jboss.aop.pointcut.ast.ASTBoolean.jjtAccept(ASTBoolean.java:37)
                            11:10:00,083 ERROR [STDERR] at org.jboss.aop.pointcut.MatcherHelper.visit(MatcherHelper.java:88)
                            11:10:00,083 ERROR [STDERR] at org.jboss.aop.pointcut.MatcherHelper.matches(MatcherHelper.java:83)
                            11:10:00,083 ERROR [STDERR] at org.jboss.aop.pointcut.PointcutExpression.matchesExecution(PointcutExpression.java:191)
                            11:10:00,083 ERROR [STDERR] at org.jboss.aop.instrument.JoinpointClassifier$3.matches(JoinpointClassifier.java:99)
                            11:10:00,083 ERROR [STDERR] at org.jboss.aop.instrument.JoinpointSimpleClassifier.classifyJoinpoint(JoinpointSimpleClassifier.java:65)
                            11:10:00,084 ERROR [STDERR] at org.jboss.aop.instrument.JoinpointClassifier.classifyConstructorExecution(JoinpointClassifier.java:160)
                            11:10:00,084 ERROR [STDERR] at org.jboss.aop.instrument.ConstructorExecutionTransformer.classifyConstructor(ConstructorExecutionTransformer.java:484)
                            11:10:00,084 ERROR [STDERR] at org.jboss.aop.instrument.ConstructorExecutionTransformer.transform(ConstructorExecutionTransformer.java:141)
                            11:10:00,084 ERROR [STDERR] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:660)
                            11:10:00,084 ERROR [STDERR] at org.jboss.aop.AspectManager.translate(AspectManager.java:908)
                            11:10:00,084 ERROR [STDERR] at org.jboss.aop.AspectManager.transform(AspectManager.java:820)
                            11:10:00,084 ERROR [STDERR] at org.jboss.aop.standalone.AOPTransformer.aspectTransform(AOPTransformer.java:88)
                            11:10:00,085 ERROR [STDERR] at org.jboss.aop.standalone.AOPTransformer.transform(AOPTransformer.java:75)
                            11:10:00,085 ERROR [STDERR] at sun.instrument.TransformerManager.transform(TransformerManager.java:122)
                            11:10:00,085 ERROR [STDERR] at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:155)
                            11:10:00,085 ERROR [STDERR] at java.lang.ClassLoader.defineClass1(Native Method)
                            11:10:00,085 ERROR [STDERR] at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
                            11:10:00,085 ERROR [STDERR] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
                            11:10:00,085 ERROR [STDERR] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
                            11:10:00,086 ERROR [STDERR] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
                            11:10:00,086 ERROR [STDERR] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
                            11:10:00,086 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
                            11:10:00,086 ERROR [STDERR] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                            11:10:00,086 ERROR [STDERR] at org.jboss.mx.loading.RepositoryClassLoader.findClassLocally(RepositoryClassLoader.java:672)
                            11:10:00,086 ERROR [STDERR] at org.jboss.mx.loading.RepositoryClassLoader.findClass(RepositoryClassLoader.java:652)
                            11:10:00,086 ERROR [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                            11:10:00,087 ERROR [STDERR] at org.jboss.mx.loading.RepositoryClassLoader.loadClassLocally(RepositoryClassLoader.java:190)
                            11:10:00,087 ERROR [STDERR] at org.jboss.mx.loading.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:131)
                            11:10:00,087 ERROR [STDERR] at org.jboss.mx.loading.LoadMgr3.nextTask(LoadMgr3.java:399)
                            11:10:00,087 ERROR [STDERR] at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:517)
                            11:10:00,087 ERROR [STDERR] at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
                            11:10:00,087 ERROR [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                            11:10:00,087 ERROR [STDERR] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
                            11:10:00,088 ERROR [STDERR] at java.lang.Class.getDeclaredConstructors0(Native Method)
                            11:10:00,088 ERROR [STDERR] at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
                            11:10:00,088 ERROR [STDERR] at java.lang.Class.getConstructor0(Class.java:2640)
                            11:10:00,088 ERROR [STDERR] at java.lang.Class.newInstance0(Class.java:321)
                            11:10:00,088 ERROR [STDERR] at java.lang.Class.newInstance(Class.java:303)
                            11:10:00,088 ERROR [STDERR] at org.jboss.aop.advice.PerVmAdvice.generateInterceptor(PerVmAdvice.java:128)
                            11:10:00,088 ERROR [STDERR] at org.jboss.aop.advice.PerVmAdvice.generateOptimized(PerVmAdvice.java:52)
                            11:10:00,088 ERROR [STDERR] at org.jboss.aop.advice.AdviceFactory.create(AdviceFactory.java:68)
                            11:10:00,088 ERROR [STDERR] at org.jboss.aop.Advisor.createInterceptorChain(Advisor.java:612)
                            11:10:00,088 ERROR [STDERR] at org.jboss.aop.Advisor.pointcutResolved(Advisor.java:882)
                            11:10:00,092 ERROR [STDERR] at org.jboss.aop.Advisor.resolveConstructorPointcut(Advisor.java:835)
                            11:10:00,093 ERROR [STDERR] at org.jboss.aop.ClassAdvisor.createInterceptorChains(ClassAdvisor.java:607)
                            11:10:00,093 ERROR [STDERR] at org.jboss.aop.ClassAdvisor.access$300(ClassAdvisor.java:82)
                            11:10:00,093 ERROR [STDERR] at org.jboss.aop.ClassAdvisor$1.run(ClassAdvisor.java:299)
                            11:10:00,093 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
                            11:10:00,093 ERROR [STDERR] at org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:271)
                            11:10:00,093 ERROR [STDERR] at org.jboss.aop.AspectManager.initialiseClassAdvisor(AspectManager.java:590)
                            11:10:00,093 ERROR [STDERR] at org.jboss.aop.AspectManager.getAdvisor(AspectManager.java:578)
                            11:10:00,093 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$MXPoolListener.<clinit>(Http11Protocol.java)
                            11:10:00,093 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:65)
                            11:10:00,093 ERROR [STDERR] at org.apache.catalina.connector.Connector.start(Connector.java:1089)
                            11:10:00,093 ERROR [STDERR] at org.jboss.web.tomcat.tc5.Tomcat5.startConnectors(Tomcat5.java:590)
                            11:10:00,094 ERROR [STDERR] at org.jboss.web.tomcat.tc5.Tomcat5.handleNotification(Tomcat5.java:627)
                            11:10:00,094 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                            11:10:00,094 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                            11:10:00,094 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
                            11:10:00,094 ERROR [STDERR] at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
                            11:10:00,094 ERROR [STDERR] at $Proxy41.handleNotification(Unknown Source)
                            11:10:00,094 ERROR [STDERR] at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:127)
                            11:10:00,094 ERROR [STDERR] at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:108)
                            11:10:00,094 ERROR [STDERR] at org.jboss.system.server.ServerImpl.sendNotification(ServerImpl.java:908)
                            11:10:00,094 ERROR [STDERR] at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:497)
                            11:10:00,095 ERROR [STDERR] at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
                            11:10:00,095 ERROR [STDERR] at org.jboss.Main.boot(Main.java:200)
                            11:10:00,095 ERROR [STDERR] at org.jboss.Main$1.run(Main.java:490)
                            11:10:00,095 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
                            11:10:00,100 ERROR [STDERR] Caused by: javassist.NotFoundException: healthGuide.IHealthUnitRepository
                            11:10:00,100 ERROR [STDERR] at javassist.ClassPool.get(ClassPool.java:416)
                            11:10:00,100 ERROR [STDERR] at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:549)
                            11:10:00,100 ERROR [STDERR] at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:499)
                            11:10:00,100 ERROR [STDERR] at javassist.CtField.getType(CtField.java:297)
                            11:10:00,100 ERROR [STDERR] at org.jboss.aop.pointcut.FieldMatcher.visit(FieldMatcher.java:102)
                            
                            


                            • 11. Re: probleam in granularity of interception
                              flavia.rainone.old

                              I've just run an example and it works to me, no matter whether the servlet calls directly the constructor, or the private constructor of HealthWatcherFacade does it.

                              Please, run your servlet only with the pontcut:

                               <pointcut name="recordsCreation"
                               expr="call(employee.EmployeeRecord->new(..))" />
                              



                              and the binding:
                              
                              
                               <bind pointcut="recordsCreation">
                               <advice
                               aspect="aspects.dataManagement.nonpersistent.DataCollectionNonPersistent"
                               name="aroundRecordsCreation" />
                               </bind>
                              
                              


                              And tell me if you can see on the aopc log something like:

                               [aopc] [debug] was HealthWatcherFacade converted: true
                              


                              This line will appear either way. The only thing is that JBoss AOP should instrument it. If it doesn't, this line will appear with a false instead of true.


                              • 12. Re: probleam in granularity of interception
                                fabiocsilva

                                return true:

                                ...
                                 [aopc] [debug] was controllers.HealthWatcherFacade converted: true
                                 [aopc] [compiled] /home/fabio/workspace/HealthWatcher_AO_JBossAOP/bin/controllers/HealthWatcherFacade.class
                                 [aopc] [trying to transform] exceptions.ExceptionMessages
                                 [aopc] [debug] javassist.CtConstructor@1ef9157[public ExceptionMessages ()V] matches no pointcuts
                                 [aopc] [debug] was exceptions.ExceptionMessages converted: false
                                 [aopc] [no comp needed] /home/fabio/workspace/HealthWatcher_AO_JBossAOP/bin/exceptions/ExceptionMessages.class
                                 [aopc] [trying to transform] gui.servlets.ServletInsertSpecialComplaint
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] javassist.CtMethod@4401295e[public init (Ljavax/servlet/ServletConfig;)V] matches no pointcuts
                                 [aopc] [debug] javassist.CtMethod@8bb1d60[public doPost (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V] matches no pointcuts
                                 [aopc] [debug] javassist.CtConstructor@12f0999[public ServletInsertSpecialComplaint ()V] matches no pointcuts
                                 [aopc] [debug] gui.servlets.ServletInsertSpecialComplaint.healthWatcher:Lcontrollers/HealthWatcherFacade; matches no pointcuts
                                 [aopc] [debug] gui.servlets.ServletInsertSpecialComplaint.healthWatcher:Lcontrollers/HealthWatcherFacade; matches no pointcuts
                                 [aopc] [debug] was gui.servlets.ServletInsertSpecialComplaint converted: false
                                 [aopc] [no comp needed] /home/fabio/workspace/HealthWatcher_AO_JBossAOP/bin/gui/servlets/ServletInsertSpecialComplaint.class
                                 [aopc] [trying to transform] aspects.distribution.AbstractServerSideAspect
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] javassist.CtMethod@6c0a65c0[abstract initFacadeInstance ()Ljava/rmi/Remote;] matches no pointcuts
                                 [aopc] [debug] javassist.CtMethod@2e5a5a51[abstract getSystemName ()Ljava/lang/String;] matches no pointcuts
                                 [aopc] [debug] javassist.CtMethod@a03c8b01[public beforeFacadeMainExecution (Lorg/jboss/aop/joinpoint/Invocation;)Ljava/lang/Object;] matches no pointcuts
                                 [aopc] [debug] javassist.CtMethod@f62fe68a[private rmiFacadeExceptionHandling (Ljava/lang/Throwable;)V] matches no pointcuts
                                 [aopc] [debug] javassist.CtConstructor@11f2ee1[public AbstractServerSideAspect ()V] matches no pointcuts
                                 [aopc] [debug] was aspects.distribution.AbstractServerSideAspect converted: false
                                 [aopc] [no comp needed] /home/fabio/workspace/HealthWatcher_AO_JBossAOP/bin/aspects/distribution/AbstractServerSideAspect.class
                                 [aopc] [trying to transform] aspects.distribution.HealthWatcherServerSideAspect
                                 [aopc] [debug] MethodCall does not match: call(employee.EmployeeRecord->new(..))
                                 [aopc] [debug] MethodCall does not match: recordsCreation
                                 [aopc] [debug] javassist.CtMethod@2e5a5a51[ getSystemName ()Ljava/lang/String;] matches no pointcuts
                                 [aopc] [debug] javassist.CtMethod@c93af865[ getServerName ()Ljava/lang/String;] matches no pointcuts
                                 [aopc] [debug] javassist.CtMethod@ccba27a7[public setServerName (Ljava/lang/String;)V] matches no pointcuts
                                 [aopc] [debug] javassist.CtMethod@6c0a65c0[ initFacadeInstance ()Ljava/rmi/Remote;] matches no pointcuts
                                 [aopc] [debug] javassist.CtConstructor@3ecfff[public HealthWatcherServerSideAspect ()V] matches no pointcuts
                                 [aopc] [debug] aspects.distribution.HealthWatcherServerSideAspect.RMI_SERVER_NAME:Ljava/lang/String; matches no pointcuts
                                 [aopc] [debug] aspects.distribution.HealthWatcherServerSideAspect.RMI_SERVER_NAME:Ljava/lang/String; matches no pointcuts
                                 [aopc] [debug] was aspects.distribution.HealthWatcherServerSideAspect converted: false
                                 [aopc] [no comp needed] /home/fabio/workspace/HealthWatcher_AO_JBossAOP/bin/aspects/distribution/HealthWatcherServerSideAspect.class
                                 [aopc] [trying to transform] exceptions.ObjectNotFoundException
                                 [aopc] [debug] javassist.CtConstructor@1c99159[public ObjectNotFoundException (Ljava/lang/String;)V] matches no pointcuts
                                 [aopc] [debug] was exceptions.ObjectNotFoundException converted: false
                                 [aopc] [no comp needed] /home/fabio/workspace/HealthWatcher_AO_JBossAOP/bin/exceptions/ObjectNotFoundException.class
                                 [aopc] Build Successful: 4153 ms
                                



                                • 13. Re: probleam in granularity of interception
                                  fabiocsilva

                                  but

                                   [aopc] [debug] was employee.EmployeeRecord converted: false
                                  


                                  • 14. Re: probleam in granularity of interception
                                    flavia.rainone.old

                                    The empoloyee shouldn't be converted.
                                    You are intercepting the call, and the call to the constructor is inside HealthWatcherFacade.

                                    So, this is step is ok.

                                    Next test (this may seem a silly question, but we need to check everything): are you sure doPost is being called?
                                    Use a System.out.println to verify that. And, is the constructor of HealthWatcherFacede being called too?
                                    And, finally, put a print inside of the constructor of EmployeeRecord.

                                    Something is wrong here, and we need to find out which step is messing your example.

                                    1 2 Previous Next