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

  • Spring 2.0M2 AOP issue

    Can anyone shed any light on this error?

    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.aop.support.DefaultPointcutAd visor#3': Cannot create inner bean '(inner bean)' while setting bean property 'advice'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
    java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
    at org.springframework.aop.aspectj.AbstractAspectJAdv ice.bindArgumentsByName(AbstractAspectJAdvice.java :297)

    ------------------------------------------------------

    <?xml version="1.0" encoding="UTF-8"?>

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd">


    <!--CLASS-->
    <bean id="kwikEMart"class="com.springinaction.chapter03. store.ApuKwikEMart"/>
    <bean id="customer" class="com.springinaction.chapter03.store.Customer ">
    <property name="name" value="Connie Consumer"/>
    </bean>

    <!--ADVICE-->
    <bean id="KwikEMartAdvice" class="com.springinaction.chapter03.store.KwikEMar tAdvice" />

    <!--CONFIG-->
    <aop:config>
    <aop:aspect id="KwikEMartAspect1" ref="KwikEMartAdvice">
    <aopointcut id="KwikE" expression="execution(* buySquishee(..))" />
    <aop:advice kind="around" method="invoke" pointcut-ref="KwikE" />
    <aop:advice kind="before" method="before" pointcut-ref="KwikE" />
    <aop:advice kind="after" method="afterReturning" pointcut-ref="KwikE" />
    <aop:advice kind="afterThrowing" method="afterThrowing" pointcut-ref="KwikE" />
    </aop:aspect>
    </aop:config>
    </beans>

  • #2
    You need the asm-1.4.3.jar file in your classpath.

    Comment


    • #3
      Added asm-2.2.1.jar to buildpath; similar error.

      Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.aop.support.DefaultPointcutAd visor#3': Cannot create inner bean '(inner bean)' while setting bean property 'advice'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor
      org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor
      java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java :620)
      at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:124)
      at java.net.URLClassLoader.defineClass(URLClassLoader .java:260)
      at java.net.URLClassLoader.access$100(URLClassLoader. java:56)
      at java.net.URLClassLoader$1.run(URLClassLoader.java: 195)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:268)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
      at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
      at org.springframework.aop.aspectj.AbstractAspectJAdv ice.bindArgumentsByName(AbstractAspectJAdvice.java :297)
      at org.springframework.aop.aspectj.AbstractAspectJAdv ice.calculateArgumentBindings(AbstractAspectJAdvic e.java:269)
      at org.springframework.aop.aspectj.AbstractAspectJAdv ice.afterPropertiesSet(AbstractAspectJAdvice.java: 232)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:860)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:829)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:409)
      at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveInnerBeanDefinition(Bea nDefinitionValueResolver.java:151)
      at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:102)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:764)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:575)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:405)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:238)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:148)
      at org.springframework.aop.framework.autoproxy.Defaul tAdvisorAutoProxyCreator.findCandidateAdvisors(Def aultAdvisorAutoProxyCreator.java:114)
      at org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.setBeanFactory(AbstractA dvisorAutoProxyCreator.java:57)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:822)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:409)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:238)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:148)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeansOfType(DefaultListableB eanFactory.java:199)
      at org.springframework.context.support.AbstractApplic ationContext.getBeansOfType(AbstractApplicationCon text.java:672)
      at org.springframework.context.support.AbstractApplic ationContext.registerBeanPostProcessors(AbstractAp plicationContext.java:425)
      at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:316)
      at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:87)
      at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:72)
      at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:63)
      at com.springinaction.chapter03.store.Main.main(Main. java:11)

      --------------------------------------------

      <?xml version="1.0" encoding="UTF-8"?>

      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:aop="http://www.springframework.org/schema/aop"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schem...ring-beans.xsd
      http://www.springframework.org/schema/aop
      http://www.springframework.org/schema/aop/spring-aop.xsd">


      <!--CLASS-->
      <bean id="kwikEMart" class="com.springinaction.chapter03.store.ApuKwikE Mart"/>
      <bean id="customer" class="com.springinaction.chapter03.store.Customer ">
      <property name="name" value="Connie Consumer"/>
      </bean>

      <!--ADVICE-->
      <bean id="KwikEMartAdvice" class="com.springinaction.chapter03.store.KwikEMar tAdvice" />

      <!--CONFIG-->
      <aop:config>
      <aop:aspect id="KwikEMartAspect1" ref="KwikEMartAdvice">
      <aop:advice kind="around"
      method="invoke"
      pointcut="execution(* buySquishee(..))" />
      <aop:advice kind="before"
      method="before"
      pointcut="execution(* buySquishee(..))" />
      <aop:advice kind="after"
      method="afterReturning"
      pointcut="execution(* buySquishee(..))" />
      <aop:advice kind="afterThrowing"
      method="afterThrowing"
      pointcut="execution(* buySquishee(..))" />
      </aop:aspect>
      </aop:config>
      </beans>
      Last edited by Bill Fly; Feb 23rd, 2006, 02:24 PM.

      Comment


      • #4
        hi,
        between asm 1.x and 2.x there's beena a major API change, and some classes have been moved or deleted. Try using asm 1.4.3 as suggested in previous post.

        valerio

        Comment


        • #5
          I would be concerned with running version 1 asm with version 2 Spring.

          Version 1 with version 2?

          Comment


          • #6
            i thought you were referring to spring 1.2.x can't say anything about spring 2.x dependancy.

            good luck
            valerio

            Comment


            • #7
              Sorry, asm-2.2.1 is the right version to use with spring-2.0m2. It appears you also need asm-commons-2.2.1.jar.

              Comment


              • #8
                ::0 formal unbound in pointcut

                I have included all the jar files in the asm folder in the buildpath. Now I get the following error:
                Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'kwikEMart' defined in class path resource [com/springinaction/chapter03/store/kwikemart.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
                java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
                at org.aspectj.weaver.tools.PointcutParser.parsePoint cutExpression(PointcutParser.java:326)
                at org.springframework.aop.aspectj.AspectJExpressionP ointcut.checkReadyToMatch(AspectJExpressionPointcu t.java:168)
                at org.springframework.aop.aspectj.AspectJExpressionP ointcut.getClassFilter(AspectJExpressionPointcut.j ava:103)
                at org.springframework.aop.support.AopUtils.canApply( AopUtils.java:195)
                at org.springframework.aop.support.AopUtils.canApply( AopUtils.java:228)
                at org.springframework.aop.support.AopUtils.findAdvis orsThatCanApply(AopUtils.java:247)
                at org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.findEligibleAdvisors(Abs tractAdvisorAutoProxyCreator.java:76)
                at org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.getAdvicesAndAdvisorsFor Bean(AbstractAdvisorAutoProxyCreator.java:62)
                at org.springframework.aop.framework.autoproxy.Abstra ctAutoProxyCreator.postProcessAfterInitialization( AbstractAutoProxyCreator.java:240)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyBeanPostProcessors AfterInitialization(AbstractAutowireCapableBeanFac tory.java:306)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:837)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:409)
                at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:238)
                at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:148)
                at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:253)
                at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:331)
                at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:87)
                at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:72)
                at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:63)
                at com.springinaction.chapter03.store.Main.main(Main. java:11)

                Comment


                • #9
                  I believe this means that the methods on your advice bean are expecting parameters to be passed but your pointcut expression doesn't define them. You either need to remove the arguments from your invoke/before/etc methods or update your pointcut expression to define and bind the arguments. It might also help to try to get the advice working one at a time instead of all 4 at once.

                  Comment

                  Working...
                  X