首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

class path resource [applicationContext.xml] does not exist解决方法

2012-05-22 
class path resource [applicationContext.xml]does not existssh整合的问题贴出Action代码Java codepacka

class path resource [applicationContext.xml] does not exist
ssh整合的问题

贴出Action代码

Java code
package com.action; import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;import com.Dao.registrationDao;// public class registrationAction {    private String name;    private String dept;            public registrationAction() {        super();    }    public registrationAction(String name, String dept) {        super();        this.name = name;        this.dept = dept;    }    public String execute(){        System.out.println("--------registrationAction--------");        //spring 管理DAO IOC         ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");                registrationDao DaoFactory = (registrationDao) ac.getBean("registration");                  DaoFactory.addEmployee(name, dept);                 return "success";    }      public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    public String getDept() {        return dept;    }    public void setDept(String dept) {        this.dept = dept;    }    }

 执行到Sysout("......");页面出现错误:
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
applicationContext.xml 放在WEB-INF下

[解决办法]
肯定错呀,你那个applicationContext.xml文件是容器启动就加载,你现在哪有肯定不行的

热点排行