日期:2014-05-17  浏览次数:20781 次

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文件是容器启动就加载,你现在哪有肯定不行的