Action action = (Action) factory.getBean("TheAction");
看下你这句强制转换的 类型到底匹配不?

解决方案 »

  1.   

     FileInputStream  is   =   new    FileInputStream("bean.xml")
      

  2.   

    Action action = (Action) factory.getBean("TheAction");
    查看TheAction类是否继承了Action类在        XmlBeanFactory factory = new XmlBeanFactory((Resource) is);
            Action action = (Action) factory.getBean("TheAction");
    每行之前打印测试消息看是那行转换失败
      

  3.   

    InputStream is = new FileInputStream("bean.xml");
    这个错了
      

  4.   

    XmlBeanFactory factory = new XmlBeanFactory((Resource) is);
    这个错了
      

  5.   

    Action action = (Action) factory.getBean("TheAction"); 
    类型转换失败