Spring Security 3 ASM Jar包问题

在SPRING 官方网站上下载了Spring Security3.2的源码,运行里面的spring-security-samples-insecure这个Demo,使用Maven生成war包,放入到TOMCAT7下允许,JDK版本使用是1.6.0.45,启动时总是报如下异常:
[img]http://dl2.iteye.com/upload/attachment/0095/7142/2acc5172-f4ea-3db4-b9de-c446605e8ace.png[/img]


at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoSuchMethodError: org.springframework.asm.ClassReader.accept(Lorg/springframework/asm/ClassVisitor;I)V
at org.springframework.cglib.core.ClassNameReader.getClassInfo(ClassNameReader.java:41)
at org.springframework.cglib.core.ClassNameReader.getClassName(ClassNameReader.java:34)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217)
at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:116)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:108)
at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:104)
at org.springframework.cglib.proxy.Enhancer.(Enhancer.java:69)
at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:104)
at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:92)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:358)


在网上查了原因,说是Spring-asm.jar 在Spring3.2以后就被集成到Spring-core.jar包里面,所以不需要单独引入Spring-asm.jar的jar包。而我的工程里面根本没有引入。
想来想去找不到解决方案,网上说有可能是JDK版本的问题,我试着换成MyEclipse8.6自带JDK,版本是1.6.0.13,居然成功了,我又换成JDK1.7,也是OK,应该是我JDK版本的问题,我修改了我的JDK文件。
特此记录一下。以防备用。[url]http://docs.spring.io/spring-security/site/docs/3.2.x/guides/helloworld.html[/url]官方的步骤

工程已经上传,可以直接放入到tomcat下运行。

你可能感兴趣的:(原创,Spring,Security,ASM,异常)