Spring Error - java.lang.NoSuchMethodError:&gt; org.springframework.beans.factory.annotation.InjectionMetadata。<初始化> </INIT>

时间:2012-09-12 11:32:07

标签: java spring jar annotations spring-3

民间,

我正在尝试运行一个使用@Required.

的简单弹簧示例

但是,当我运行main方法类时,我会遇到异常跟踪?

  

线程“main”中的异常java.lang.NoSuchMethodError:   org.springframework.beans.factory.annotation.InjectionMetadata(Ljava /郎/类; Ljava / util的/收藏):V     在   org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:377)     在   org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:295)     在   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:750)     在   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:451)     在   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory $ 1.run(AbstractAutowireCapableBeanFactory.java:412)     在java.security.AccessController.doPrivileged(Native Method)at   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383)     在   org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:276)     在   org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)     在   org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273)     在   org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:175)     在   org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:485)     在   org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:716)     在   org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377)     在   org.springframework.context.support.ClassPathXmlApplicationContext。(ClassPathXmlApplicationContext.java:139)     在   org.springframework.context.support.ClassPathXmlApplicationContext。(ClassPathXmlApplicationContext.java:83)     在   com.springexamples.annotation.required.EmployeeTest.main(EmployeeTest.java:19)

我是否在classpath中缺少任何特定的jar?

由于

1 个答案:

答案 0 :(得分:4)

这看起来非常像版本不匹配。你确定你的所有Spring罐子都是同一个版本吗?