at org.springframework.asm.ClassReader.(Unknown Source)

有一次down同事的代码下来运行,结果发现运行不起来,一开始怀疑是配置问题,但同事那边是ok,那想着就是环境问题了,但看了许久,发现也没有看出来,看了下是asm包报出来,然后看asm是Cglib依赖进来的,想着这个问题就应该是版本冲突导致的吧,google了一下,果真发现是jdk7和jdk8版本导致项目中依赖起了冲突。mark一下:项目中用到spring还是3.2的版本,然后看到stackoverflow是这么回答的: 
The exception you see is not very likely to be cause by invalid Spring configuration but your classpath setup. This feels like a version incompatibility regarding the ASM libraries and Java 8. The ASM version, Spring 3.2 depends on is known to be incompatible with Java 8.

Thus, if you want run your code with Java 8, you need to use a recent Spring 4.0 version

方法测试可行。

异常栈:

 INFO [main] (ZNWebSocketServer.java:35) - 2016-10-15 21:44:02,471 - Load log4j.properties from file system!
 INFO [main] (AbstractApplicationContext.java:510) - 2016-10-15 21:44:02,596 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@e2144e4: startup date [Sat Oct 15 21:44:02 CST 2016]; root of context hierarchy
 INFO [main] (XmlBeanDefinitionReader.java:315) - 2016-10-15 21:44:02,689 - Loading XML bean definitions from class path resource [applicationContext.xml]
 INFO [main] (XmlBeanDefinitionReader.java:315) - 2016-10-15 21:44:02,939 - Loading XML bean definitions from class path resource [dao.xml]
Exception in thread "main" java.lang.IllegalArgumentException
        at org.springframework.asm.ClassReader.(Unknown Source)
        at org.springframework.asm.ClassReader.(Unknown Source)
        at org.springframework.asm.ClassReader.(Unknown Source)
        at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:52)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
        at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:70)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
        at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)
        at com.szzhaona.ZNWebSocketServer.main(ZNWebSocketServer.java:41)


你可能感兴趣的:(J2EE)