Announcement Announcement Module
No announcement yet.
AOP Issues with non-Spring instantiated Groovy script bean Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP Issues with non-Spring instantiated Groovy script bean

    This seems to be somewhat related to

    I am instantiating a Groovy bean using a GroovyClassLoader, and then handing it to a Spring context to be wired.

    I'm getting the following exception:

    org.aspectj.weaver.reflect.ReflectionWorld$Reflect ionWorldException: warning can't determine implemented interfaces of missing type net.vitarara.quadran.core.web.shipping.ListShipmen tsAction [Xlint:cantFindType]

    org.aspectj.weaver.reflect.ReflectionWorld$Excepti onBasedMessageHandler.handleMessage(ReflectionWorl
    org.aspectj.weaver.MissingResolvedTypeWithKnownSig nature.raiseCantFindType(MissingResolvedTypeWithKn
    org.aspectj.weaver.MissingResolvedTypeWithKnownSig nature.getDeclaredInterfaces(MissingResolvedTypeWi
    org.aspectj.weaver.ResolvedType.getDirectSupertype s(
    org.aspectj.weaver.JoinPointSignatureIterator.find SignaturesFromSupertypes(JoinPointSignatureIterato
    org.aspectj.weaver.JoinPointSignatureIterator.hasN ext(
    org.aspectj.weaver.patterns.SignaturePattern.match es(
    org.aspectj.weaver.patterns.KindedPointcut.matchIn ternal(
    org.aspectj.weaver.patterns.Pointcut.match(Pointcu onImpl.getShadowMatch( 235) onImpl.matchesExecution(PointcutExpressionImpl.jav a:101) onImpl.matchesMethodExecution(PointcutExpressionIm
    org.springframework.aop.aspectj.AspectJExpressionP ointcut.getShadowMatch(AspectJExpressionPointcut.j ava:305)
    org.springframework.aop.aspectj.AspectJExpressionP ointcut.matches( ) orsThatCanApply(
    org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.findEligibleAdvisors(Abs
    org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.getAdvicesAndAdvisorsFor Bean(
    org.springframework.aop.framework.autoproxy.Abstra ctAutoProxyCreator.postProcessAfterInitialization( AutowireCapableBeanFactory.applyBeanPostProcessors AfterInitialization(AbstractAutowireCapableBeanFac

    I've gone down this road of instantiating my own Groovy beans because the scripting support in Spring seems to wrap scripted beans in a proxy, requiring that they implement an interface for all methods one would want to publicly expose. That just too much work. (

    I would dig into this, but I will readily admit that I am completely out of my depth here. I barely understand what a pointcut is.

    What seems very strange to me is that the GroovyClassLoader that created the bean is the classloader that my Spring context should be using.

        public void setServletContext(ServletContext servletContext) {
   ("Groovy Spring Plugin: Initializing");
            // Create the Groovy classloader and make it a child of the current thread's class loader.
            CompilerConfiguration cc = new CompilerConfiguration ();
            cc.setRecompileGroovySource (true);
            gcl = new GroovyClassLoader (Thread.currentThread().getContextClassLoader (), cc);
            ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
            // Set the appContext's class loader to the GroovyClassLoader. The refresh the context.
            (( appContext).setClassLoader (gcl);
            ((ConfigurableWebApplicationContext) appContext).refresh ();
    I would think that having made the classloader of the context the GroovyClassLoader it ought to be able to figure out what interfaces my groovy bean implements.


  • #2
    Ugh... I had the wrong Spring dependency in my pom.xml file. Changed it to 2.0.3 and the issue is gone.

    Too many pom files and example apps floating around for me.