org.springframework.beans.FatalBeanException

时间:2014-04-21 11:40:30

标签: java spring

applicationContext-service.xml

<bean id="taskAllOverService" scope="singleton" class="TaskAllOverService"/>
<bean id="taskAllOverStateCodeService" scope="singleton" class="TaskAllOverStateCodeService"/>


public class TaskAllOverService {
    protected Integer taskId;
    public Integer getTaskId() {
        return taskId;
    }

    public void setTaskId(Integer taskId) {
        this.taskId = taskId;
    }

}

public class TaskAlloverStateCodeService extend TaskAllOverService {
    public List find() {
     .......
    }

}

初始化SPRING ROOT WEBAPPLICATIONTEXT太长时间,并报告错误: [ERROR]上下文初始化失败 java.lang.NoClassDefFoundError:org.springframework.beans.FatalBeanException 我该怎么办 ?感谢您的帮助!

2 个答案:

答案 0 :(得分:0)

我觉得你没有在spring context xml文件中包含spring-beans模式。 可能你只包括spring-context schema

我不确定你还需要什么,但是如果你需要弹簧版本3.x上的spring-beans和spring-context,那么spring上下文将如下所示

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd 
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context.xsd">

答案 1 :(得分:0)

将此依赖项添加到pom.xml对我有用:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>4.1.7.RELEASE</version>
</dependency>