0 0

spring 项目启动报错org.springframework.beans.factory.annotation.InjectionMetadata5

请帮忙看下这个是什么问题。

严重: Servlet /yage threw load() exception
java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata.<init>(Ljava/lang/Class;)V
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:350)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:296)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:823)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:496)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:459)
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:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:632)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:589)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:646)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:509)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:450)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4045)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4351)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2012-1-4 15:00:41 org.apache.coyote.http11.Http11Protocol start

问题补充:
renpeng301 写道
NoSuchMethodError 找不到方法 
你用的jar不对··
检查你的springjar 看看 
Spring 2.0开始 引入了一些用于配置的annotation 



我用的是spring2.5的JAR,spring-servlet.xml中引用的是
xmlns:mvc="http://www.springframework.org/schema/mvc"
http://www.springframework.org/schema/mvc              http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

是不是spring用的JAR的版本太低了?
 
2012年1月04日 23:02

6个答案 按时间排序 按投票排序

0 0

检查一下版本不匹配:
PersistenceAnnotationBeanPostProcessor来自spring-orm jar包
InjectionMetadata  来自spring-beans jar包
检查这两个jar版本是否一致

2012年1月06日 11:04
0 0

jar包有冲突,是你引入了一个错的jar跟spring.jar有冲突

2012年1月05日 09:15
0 0

public class InjectionMetadata
extends Object

Internal class for managing injection metadata. Not intended for direct use in applications.

Used by AutowiredAnnotationBeanPostProcessor, CommonAnnotationBeanPostProcessor and PersistenceAnnotationBeanPostProcessor.

Since:
    2.5
Author:
    Juergen Hoeller 

这个2.5就有了 应该不是版本的问题可能存在下面问题
1.jar版本冲突
2.你debug下看看,工厂有没有注入成功。。。。

2012年1月05日 09:07
0 0

你可以先换以下spring的版本
然后 spring 所需要的jar 你要引用完整。

2012年1月05日 08:58
0 0

NoSuchMethodError 找不到方法 
你用的jar不对··
检查你的springjar 看看 
Spring 2.0开始 引入了一些用于配置的annotation 

2012年1月05日 08:38
0 0

spring版本的问题,换一个版本!

2012年1月04日 23:26

相关推荐

    asm-3.2.3.jar

    org.springframework.beans.factory.annotation org.springframework.beans.factory.config org.springframework.beans.factory.parsing org.springframework.beans.factory.serviceloader org.springframework....

    org.springframework.test-3.0.2.RELEASE.jar

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @...

    springAOP demo 带错误解决文档

    nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: ...

    spring源码spring-framework-4.2.5.RELEASE

    在`org.springframework.beans.factory.annotation`包中,我们可以找到AutowiredAnnotationBeanPostProcessor,它是处理@Autowired注解的关键。 5. **@Service**、**@Repository**、**@Controller**:这些是Spring ...

    spring_MVC源码

    14. &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /&gt; 15. 16. &lt;!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 --&gt; 17. &lt;bean class="org....

    springmvc-ibatis

    &lt;bean class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer"&gt; &lt;value&gt;classpath:jdbc.properties &lt;!-- 配置數據源 --&gt; &lt;bean id="dataSource" class="org.apache....

    spring-framework-4.3.14.RELEASE-docs.zip

    `org.springframework.beans.factory.BeanFactory`是Bean容器的接口,提供了更基础的Bean管理功能。 - **AOP API**:如`org.springframework.aop.framework.ProxyFactoryBean`,用于创建代理对象,实现代理模式;`...

    spring jdbctemplate 封裝

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet; import org....

    Spring In Action-2.1-01-@Component注解

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @...

    redis-lock-master.zip

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java....

    spring-data-jpa.rar

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.spring...

    Spring源代码(spring.zip)

    在`org.springframework.beans.factory.annotation`包下,`@Autowired`注解用于自动装配bean,而`@Qualifier`则用于指定特定的bean实例。 3. **AOP**:Spring的AOP模块允许开发者定义“切面”,这些切面可以封装横...

    spring-framework-reference3.2.3

    spring 3.2.3 参考文档这个版本在官网上文档都很难找,但是有归档的地址 大家不要下这个,可以到官网下载,我这里就是存一下档https://docs.spring.io/spring/docs/3.2.3.RELEASE/spring-framework-reference/html/

    Spring 3.0所需jar文件和对应的配置文件

    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang....

    spring-framework-5.3.29.tar.gz

    2. 依赖注入(Dependency Injection):在`org.springframework.beans.factory.annotation`包下,有如AutowiredAnnotationBeanPostProcessor等类,它们实现了基于注解的依赖注入。 3. AOP代理(AOP Proxy):在`org...

    最新版spring-framework-4.3.12.RELEASE-docs.zip源码

    例如,`org.springframework.beans.factory.annotation.Autowired`注解用于实现依赖注入,`org.springframework.web.bind.annotation.RequestMapping`用于处理HTTP请求映射,`org.springframework.context....

    spring-boot-reference.pdf

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.test.web.servlet.MockMvc; import ...

    spring定时器

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.spring...

    spring3.07

    源码中,我们可以看到 `org.springframework.beans.factory.annotation.Autowired` 注解用于自动装配依赖,以及 `org.springframework.beans.factory.BeanFactory` 和 `org.springframework.beans.factory.config....

Global site tag (gtag.js) - Google Analytics