Announcement Announcement Module
Collapse
No announcement yet.
Spring AOP in DM Server 2.0 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring AOP in DM Server 2.0

    Hi all,

    i have a problem become my application running.
    My app using simple Proxy based AOP support based on @AspectJ style.
    so the following pointut

    Code:
      
    <aop:config proxy-target-class="true">
        <aop:aspect ref="ExceptionHandlerAspect">
          <aop:pointcut id="businessServiceLayerPointcut" expression="com.topas.server.core.exception.ExceptionHandlerAspect.businessServiceLayerPointcut()" />
          <aop:around method="transformExceptionAdvice" pointcut-ref="businessServiceLayerPointcut"/>
        </aop:aspect>
        <aop:aspect ref="DomainPersistenceAspect">
          <aop:pointcut id="onPersistenceFindOperation" expression="com.topas.server.domain.DomainPersistenceAwareAspect.onPersistenceFindOperation()"/>
          <aop:before method="aroundPersistenceFindOperation" pointcut-ref="onPersistenceFindOperation"/>
        </aop:aspect>
      </aop:config>
    
    ... @AspectJ style Pointcut inside the ExceptionHandlerAspect class
    
      @Pointcut(value = "execution(public * com.topas.server.businesslogic.IBusinessService+.*(..))")
      public void onServiceInstanceLayerPointcut() {
      };
     
      @Pointcut(value = "within(com..*) && @within(com.topas.server.businesslogic.annotation.BusinessService) && (execution(public * com.topas..*.*(..)) || execution(public * com.ecg..*.*(..)))")
      public void onServiceAnnotatedLayerPointcut() {
      };
    
      @Pointcut(value="onServiceInstanceLayerPointcut() || onServiceAnnotatedLayerPointcut()")
      public void businessServiceLayerPointcut() {   
      }
    lead me to an class loading Error like below.

    Code:
    [2010-02-28 12:45:57.469] Thread-3                     <AG0000E> Application context creation failure for bundle 'topas-server' version '1.0.2.BUILD-SNAPSHOT'. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'JMXMBeanExporter' defined in OSGi resource[classpath:META-INF/topas-server/jmxContext.xml|bnd.id=74|bnd.sym=topas-server]: Initialization of bean failed; nested exception is org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine annotations of missing type com.springsource.kernel.dmfragment.internal.KernelMBeanExporter
     [Xlint:cantFindType]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
    	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
    	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
    	at com.springsource.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:106)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:619)
    Caused by: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine annotations of missing type com.springsource.kernel.dmfragment.internal.KernelMBeanExporter
     [Xlint:cantFindType]
    	at org.aspectj.weaver.reflect.ReflectionWorld$ExceptionBasedMessageHandler.handleMessage(ReflectionWorld.java:129)
    	at org.aspectj.weaver.Lint$Kind.signal(Lint.java:316)
    	at org.aspectj.weaver.MissingResolvedTypeWithKnownSignature.raiseCantFindType(MissingResolvedTypeWithKnownSignature.java:223)
    	at org.aspectj.weaver.MissingResolvedTypeWithKnownSignature.hasAnnotation(MissingResolvedTypeWithKnownSignature.java:174)
    	at org.aspectj.weaver.patterns.ExactAnnotationTypePattern.fastMatches(ExactAnnotationTypePattern.java:84)
    	at org.aspectj.weaver.patterns.WithinAnnotationPointcut.fastMatch(WithinAnnotationPointcut.java:80)
    	at org.aspectj.weaver.patterns.AndPointcut.fastMatch(AndPointcut.java:48)
    	at org.aspectj.weaver.patterns.AndPointcut.fastMatch(AndPointcut.java:48)
    	at org.aspectj.weaver.internal.tools.PointcutExpressionImpl.couldMatchJoinPointsInType(PointcutExpressionImpl.java:78)
    	at org.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:236)
    	at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:198)
    	at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:252)
    	at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:284)
    	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117)
    	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)
    	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)
    	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
    	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:404)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1407)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
    	... 16 common frames omitted

    if i remove the pointcut expression fragment && @within(com.topas.server.businesslogic.annotation. BusinessService)
    the application seems to be starting up, try to wrapping all beans with a CGLiB Proxy.

    I assume the AspectJ Weaver is searching for all possible matching classes in the whole Class Space.

    So my Questions:

    1. Is there any way to prevent this from being happen?

    2. Is Spring AOP usable in Spring DM Applications?

  • #2
    ok, i better had to look in the forum before.
    i searched again the forum and found two threads with the same problem:

    in this thread it is recomanded to switch from Spring AOP to AspectJ LTW

    http://forum.springsource.org/showth...ght=spring+AOP

    so far so good. this Thread tells me that LTW is not supported in WebProjects

    http://forum.springsource.org/showthread.php?t=85219

    I Tried Compile Time Weaving some time before (not related to spring dm) but to manage a project setup with maven groovy and aspectj can be really a hassle. I switched back to plain Proxy based AOP and all was fine.

    ... so any suggestions to escape from this hell?

    Comment


    • #3
      I suggest you watch DMS-2390 so you are notified when it is fixed.

      Comment

      Working...
      X