Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
com/test/tools/jedis/JedisTools.init()V @117: invokespecial
Reason:
Type 'redis/clients/jedis/JedisPoolConfig' (current frame, stack[2]) is not assignable to 'org/apache/commons/pool2/impl/GenericObjectPoolConfig'
Current Frame:
bci: @117
flags: { }
locals: { 'com/test/tools/jedis/JedisTools', 'redis/clients/jedis/JedisPoolConfig', 'java/lang/String' }
stack: { uninitialized 90, uninitialized 90, 'redis/clients/jedis/JedisPoolConfig', 'java/lang/String', integer, integer, 'java/lang/String' }
Bytecode:
0x0000000: bb00 2859 b700 2a4c 2b2a b400 1db6 002b
0x0000010: b600 312b 2ab4 001d b600 35b6 0038 2b2a
0x0000020: b400 1db6 003b 85b6 003f 2b2a b400 1db6
0x0000030: 0043 b600 462b 2ab4 001d b600 4ab6 004d
0x0000040: 2ab4 001d b600 504d 2cc6 000f 1254 2cb6
0x0000050: 0056 b600 5b99 0005 014d bb00 5f59 2b2a
0x0000060: b400 1db6 0061 2ab4 001d b600 642a b400
0x0000070: 1db6 0067 2cb7 006a b300 16b1
Stackmap Table:
append_frame(@88,Object[#40],Object[#87])
same_frame(@90)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getDeclaredConstructors(Class.java:2020)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:229)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:962)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:935)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at com.test.dataprocess.Application.main(Application.java:44)
诡异的是,在MyEclipse里运行一定会出这个问题,但是项目打包成jar在外部运行是没这个问题的。
当时找了很久的答案,包括国外的网站都去看过了,一般都是说spring、jedis、和commons-pool2的版本配合问题。
然而折腾了很久觉得还真不是,因为试了很多版本都不对。
然后怒而改代码,发现无法拉起,于是考虑jar包的加载顺序问题。
用的是Spring 3.1.4版本,Jedis 2.9版本, commons-pool2 2.6.0版本。
在Order and Export里,将Jedis和commons-pool2放在spring一系列的jar包之前,编译,启动,错误消失,问题解决