Announcement Announcement Module
Collapse
No announcement yet.
Applying pointcut on groovy bean : please help Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Applying pointcut on groovy bean : please help

    Hello spring Team,

    Groovy bean is working perfectly without applying AOP. When I apply pointcut on same, I am getting following error.

    1.
    In my spring context file I have declared groovy as follow

    <!--
    <lang:groovy id="dareValidationService" script-source="classpath:com/dare/script/groovy/DareValidationService.groovy">
    </lang:groovy>
    -->



    2.
    My Groovy bean is :

    package com.dare.script.groovy;

    import com.dare.core.DareServiceException
    import com.dare.core.DareServiceRequest
    import com.dare.core.DareCoreConstants
    import com.dare.core.DareServiceRequestSupport
    import com.dare.service.validation.DareValidationService

    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;

    class GroovyDareValidationEngine implements DareValidationService {

    Log logger = LogFactory.getLog("GroovyDareValidationEngine");

    public void doService(DareServiceRequest dareServiceRequest) throws DareServiceException {
    String clientId = dareServiceRequest.getAttribute(DareCoreConstants. CLIENT_NAME)
    logger.debug("I am in Groovy. Working Nice :"+clientId)
    logger.debug("I dont know the business logic. Not taking any action")
    }

    public void doValidate(){
    logger.debug("I am in Groovy. doing validation")
    }

    //static void main(args){
    //DareServiceRequest dareServiceRequest = new DareServiceRequestSupport()
    //dareServiceRequest.setAttribute(DareCoreConstants. CLIENT_NAME,"test1")
    //GroovyDareValidationEngine t = new GroovyDareValidationEngine()
    //t.doService(dareServiceRequest)
    //}
    }


    This is working absolutely fine without applying pointcut.

    3.
    But when I apply pointcut like this :

    <aop:aspectj-autoproxy/>
    <aop:config>

    <aop:aspect ref="exceptionHandler">
    <aop:after-throwing
    throwing="dareEx"
    pointcut="execution(* com.dare.core.DareServicePipeLineSupport.doService (..))"
    method="handleServiceFailure"/>
    </aop:aspect>

    </aop:config>

    Now I am geting Following error:
    ==================================================
    [B]Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dareValidationService': BeanPostProcessor before instantiation of bean failed; nested exception is org.aspectj.weaver.reflect.ReflectionWorld$Reflect ionWorldException: warning can't determine implemented interfaces of missing type com.dare.script.groovy.GroovyDareValidationEngine
    [Xlint:cantFindType]
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:452)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 50)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:141)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:247)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:161)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:273)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:346)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:92)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:77)
    at org.springframework.context.access.ContextJndiBean FactoryLocator.createApplicationContext(ContextJnd iBeanFactoryLocator.java:101)
    at org.springframework.context.access.ContextJndiBean FactoryLocator.createBeanFactory(ContextJndiBeanFa ctoryLocator.java:89)
    at org.springframework.context.access.ContextJndiBean FactoryLocator.useBeanFactory(ContextJndiBeanFacto ryLocator.java:67)
    at org.springframework.ejb.support.AbstractEnterprise Bean.loadBeanFactory(AbstractEnterpriseBean.java:1 17)
    at org.springframework.ejb.support.AbstractMessageDri venBean.ejbCreate(AbstractMessageDrivenBean.java:7 6)
    ... 37 more
    Caused by: org.aspectj.weaver.reflect.ReflectionWorld$Reflect ionWorldException: warning can't determine implemented interfaces of missing type com.dare.script.groovy.GroovyDareValidationEngine
    [Xlint:cantFindType]
    at org.aspectj.weaver.reflect.ReflectionWorld$Excepti onBasedMessageHandler.handleMessage(ReflectionWorl d.java:163)
    at org.aspectj.weaver.Lint$Kind.signal(Lint.java:287)
    at org.aspectj.weaver.MissingResolvedTypeWithKnownSig nature.raiseCantFindType(MissingResolvedTypeWithKn ownSignature.java:198)
    at org.aspectj.weaver.MissingResolvedTypeWithKnownSig nature.getDeclaredInterfaces(MissingResolvedTypeWi thKnownSignature.java:76)
    at org.aspectj.weaver.ResolvedType.getDirectSupertype s(ResolvedType.java:65)
    at org.aspectj.weaver.JoinPointSignatureIterator.find SignaturesFromSupertypes(JoinPointSignatureIterato r.java:164)
    at org.aspectj.weaver.JoinPointSignatureIterator.hasN ext(JoinPointSignatureIterator.java:69)
    at org.aspectj.weaver.patterns.SignaturePattern.match es(SignaturePattern.java:287)
    at org.aspectj.weaver.patterns.KindedPointcut.matchIn ternal(KindedPointcut.java:106)
    at org.aspectj.weaver.patterns.Pointcut.match(Pointcu t.java:146)
    at org.aspectj.weaver.internal.tools.PointcutExpressi onImpl.getShadowMatch(PointcutExpressionImpl.java: 235)
    at org.aspectj.weaver.internal.tools.PointcutExpressi onImpl.matchesExecution(PointcutExpressionImpl.jav a:101)
    at org.aspectj.weaver.internal.tools.PointcutExpressi onImpl.matchesMethodExecution(PointcutExpressionIm pl.java:92)
    at org.springframework.aop.aspectj.AspectJExpressionP ointcut.getShadowMatch(AspectJExpressionPointcut.j ava:305)
    at org.springframework.aop.aspectj.AspectJExpressionP ointcut.matches(AspectJExpressionPointcut.java:200 )
    at org.springframework.aop.support.AopUtils.canApply( AopUtils.java:183)
    at org.springframework.aop.support.AopUtils.canApply( AopUtils.java:226)
    at org.springframework.aop.support.AopUtils.findAdvis orsThatCanApply(AopUtils.java:256)
    at org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.findEligibleAdvisors(Abs tractAdvisorAutoProxyCreator.java:85)
    at org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.getAdvicesAndAdvisorsFor Bean(AbstractAdvisorAutoProxyCreator.java:69)
    at org.springframework.aop.framework.autoproxy.Abstra ctAutoProxyCreator.postProcessAfterInitialization( AbstractAutoProxyCreator.java:265)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyBeanPostProcessors AfterInitialization(AbstractAutowireCapableBeanFac tory.java:316)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:372)
    ================================================== ========

    Spring Team please help.

    Groovy bean is working perfectly without applying AOP.

  • #2
    Guys problem is solved. Someway my build was still referrring spring 2.0.2 libraries.

    Comment

    Working...
    X