5 Replies Latest reply on Oct 29, 2008 5:49 AM by Ales Justin

    MC AOP CL issue

    Ales Justin Master

      As part of my IoC demos
      - http://anonsvn.jboss.org/repos/jbossas/projects/demos/microcontainer/trunk/ioc
      I'm deploying a jar that includes -beans.xml with some aop xml code:

       <interceptor xmlns="urn:jboss:aop-beans:1.0" name="StopWatchInterceptor" class="org.jboss.demos.ioc.annotations.StopWatchInterceptor"/>
      
       <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* @org.jboss.demos.ioc.annotations.StopWatchLog->*(..)) OR execution(* *->@org.jboss.demos.ioc.annotations.StopWatchLog(..))">
       <interceptor-ref name="StopWatchInterceptor"/>
       </bind>
      
       <bean name="AnnotatedExecutor" class="org.jboss.demos.ioc.annotations.AnnotatedExecutor">
       <constructor>
       <parameter><bean class="org.jboss.demos.ioc.annotations.SimpleExecutor"/></parameter>
       </constructor>
       </bean>
      
       <bean name="SimpleExecutorOnType" class="org.jboss.demos.ioc.annotations.SimpleExecutor">
       <annotation>@org.jboss.demos.ioc.annotations.StopWatchLog</annotation>
       </bean>
      
       <bean name="SimpleExecutorOnMethod" class="org.jboss.demos.ioc.annotations.SimpleExecutor">
       <install method="execute">
       <annotation>@org.jboss.demos.ioc.annotations.StopWatchLog</annotation>
       </install>
       </bean>
      


      This jar includes this StopWatchInterceptor class,
      but I get the following exception:
      JBoss-MC-Demo ERROR [27-10-2008 15:45:03] AbstractKernelController - Error installing to Described: name=AnnotatedExecutor state=PreInstall
      java.lang.RuntimeException: java.lang.ClassNotFoundException: org.jboss.demos.ioc.annotations.StopWatchInterceptor
       at org.jboss.aop.microcontainer.beans.GenericBeanAspectFactory.doCreate(GenericBeanAspectFactory.java:135)
       at org.jboss.aop.microcontainer.beans.GenericBeanAspectFactory.createPerVM(GenericBeanAspectFactory.java:90)
       at org.jboss.aop.AspectManager.createPerVmAspect(AspectManager.java:1942)
       at org.jboss.aop.AspectManager.getPerVMAspect(AspectManager.java:1918)
       at org.jboss.aop.Domain.getPerVMAspect(Domain.java:788)
       at org.jboss.aop.Domain.getPerVMAspect(Domain.java:773)
       at org.jboss.aop.advice.ScopedInterceptorFactory.create(ScopedInterceptorFactory.java:69)
       at org.jboss.aop.Advisor.createInterceptorChain(Advisor.java:1318)
       at org.jboss.aop.Advisor.pointcutResolved(Advisor.java:1929)
       at org.jboss.aop.MethodMatchInfo.applyBinding(MethodMatchInfo.java:152)
       at org.jboss.aop.MethodMatchInfo.overridePopulateBindings(MethodMatchInfo.java:143)
       at org.jboss.aop.MethodMatchInfo.populateBindings(MethodMatchInfo.java:92)
       at org.jboss.aop.Advisor.finalizeMethodChain(Advisor.java:1540)
       at org.jboss.aop.ClassContainer.makeInterceptorChains(ClassContainer.java:347)
       at org.jboss.aop.ClassContainer.createInterceptorChains(ClassContainer.java:313)
       at org.jboss.aop.ClassContainer.rebuildInterceptors(ClassContainer.java:138)
       at org.jboss.aop.ClassContainer.initializeClassContainer(ClassContainer.java:72)
       at org.jboss.aop.proxy.container.ClassProxyContainer.initialise(ClassProxyContainer.java:177)
       at org.jboss.aop.proxy.container.ContainerCache.createContainer(ContainerCache.java:203)
       at org.jboss.aop.proxy.container.ContainerCache.createAndCacheContainer(ContainerCache.java:191)
       at org.jboss.aop.proxy.container.ContainerCache.initClassContainer(ContainerCache.java:164)
       at org.jboss.aop.proxy.container.ContainerCache.initialise(ContainerCache.java:92)
       at org.jboss.aop.proxy.container.ContainerCache.initialise(ContainerCache.java:72)
       at org.jboss.aop.microcontainer.integration.AOPDependencyBuilder.getDependencies(AOPDependencyBuilder.java:99)
       at org.jboss.kernel.plugins.dependency.DescribeAction.installActionInternal(DescribeAction.java:56)


      The issue is that GenericBeanAspectFactory/GenericBeanFactory uses the wrong classloader != not deployment unit's classloader.

      Was this ever tested in JBoss5?
      Or what piece of code/xml am I missing in my demos?