你的spring-config.xml文件及web.xml文件也贴出来看看!

解决方案 »

  1.   

    请问三楼的,你要看struts-config.xml文件还是spring-config.xml啊?我这里好像没有spring-config.xml文件,只有applicationContext.xml文件,其实  protected ICompanyService getCompanyService(){
        return (ICompanyService)AppContext.getInstance().getAppContext().getBean("companyService");
      }
    这个方法调用的就是:
    public class AppContext {  private static AppContext instance;  private AbstractApplicationContext appContext;  public synchronized static AppContext getInstance() {
        if (instance == null) {
          instance = new AppContext();
        }
        return instance;
      }  private AppContext() {
        this.appContext = new ClassPathXmlApplicationContext(
            "/applicationContext.xml");
      }  public AbstractApplicationContext getAppContext() {
        return appContext;
      }
    }
      

  2.   

    其实我认为这个问题本质还是出在hibernate那一层。有人认同吗?
      

  3.   

    应该是spring的配置文件定义bean时的问题吧,看看是不是哪个没定义啊?
      

  4.   

    假如你去掉了 OnlineStat.hbm.xml 就可以了
    那么应该是你在 OnlineStat.hbm.xml 这里面出了问题。
      

  5.   

    这个可能是spring没有找到*.hbm.xml文件。
      

  6.   

    NoSuchBeanDefinitionException查查Bean的定义是否正确?
      

  7.   

    换了一种IDE了,原来的classpath也变了(不同的工具默认的classpath也是不一样的),正如programeyonger所说是因为spring没有找到*.hbm.xml文件,我把那个文件放到jb的class目录下就好了。
    谢谢热心的朋友!!