-
Jul 15th, 2009, 01:23 PM
#1
Spring error - very mysterious
i am creating a spring project with AOP features. I am getting this error. And the same thing created on somebody else's computer, there is no error
Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'aopTest' defined in class path resource [context.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:547)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:485)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 51)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:169)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:170)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:413)
at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:735)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:369)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:180)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:155)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:141)
at spring.aop.Main.main(Main.java:18)
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V
at net.sf.cglib.core.DebuggingClassWriter.<init>(Debu ggingClassWriter.java:47)
at net.sf.cglib.core.DefaultGeneratorStrategy.getClas sWriter(DefaultGeneratorStrategy.java:30)
at net.sf.cglib.core.DefaultGeneratorStrategy.generat e(DefaultGeneratorStrategy.java:24)
at net.sf.cglib.core.AbstractClassGenerator.create(Ab stractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyF actory.java:144)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.jav a:116)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.jav a:108)
I have all the required jars and if i run the same thing in another computer, it runs fine.
ok if i change a line in context.xml as
<context:annotation-config/>
<!--aop:aspectj-autoproxy/-->
<aop:aspectj-autoproxy>
<aop:include name="aopTest"/>
</aop:aspectj-autoproxy>
<bean id="aopTest" name="alias1 alias2" class="spring.aop.AopTest"/>
<bean id="aspectBean" class="spring.aop.BeforeExample"/>
it then compiles successfully but none of the advice are executed
-
Jul 16th, 2009, 04:19 AM
#2
Maybe on the other computer there's some slight classpath difference.
The problem seems to come from asm.jar. Either this jar is not there or its version is incompatible with your cglib.jar
If possible, I recommend to use cglib_nodep.jar as this already includes asm.
Also check out other components in your application which use cglib (e.g. hibernate). If these also add their jars to the classpath and use a different version then order matters.
Regards,
Andreas
P.S.: Please use [ code ] [ /code ] tags to improve readability
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules