1

伙计们,

我正在尝试运行一个简单的使用弹簧示例@Required.

但是,当我运行主方法类时,我得到以下异常跟踪?

线程“主”java.lang.NoSuchMethodError 中的异常:org.springframework.orm.jpa.support 上的 org.springframework.beans.factory.annotation.InjectionMetadata.(Ljava/lang/Class;Ljava/util/Collection;)V。 PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:377) at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:295) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.apply.wireMerged 750) 在 org.springframework.beans.factory 的 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:451)。support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:412) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383) at 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) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:716) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377) at org.springframework .context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) at com.springexamples.annotation.required.EmployeeTest.main(EmployeeTest.java:19 )context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)在 com.springexamples.annotation.required.EmployeeTest.main(EmployeeTest.java:19)context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)在 com.springexamples.annotation.required.EmployeeTest.main(EmployeeTest.java:19)

类路径中是否缺少任何特定的 jar?

谢谢

4

1 回答 1

4

这看起来很像版本不匹配。你确定你所有的 Spring jar 都是相同的版本吗?

于 2012-09-12T11:41:41.557 回答