当提示以下内容是什么问题,该如何修改?
Unable to instantiate Action, com.institution.action.InstitutionAction,  defined for 'findAllInstitution' in namespace '/institution'Error creating bean with name 'com.institution.action.InstitutionAction': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.institution.action.InstitutionAction.setIm(com.institution.service.InstitutionManage); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/annotations/Entity

解决方案 »

  1.   

    你这是缺包啊。 个人不建议使用hibernate标注,建议采用jpa标注。hibernate标注:hibernate-annotations-3.4.0.GA.jar
    jpa标注:ejb3-persistence-1.0.2.GA.jar自己搜索下载一下。
      

  2.   

    我把那个包添加到引用的库下,结果还是不行,出现下面提示:Unable to instantiate Action, com.institution.action.InstitutionAction,  defined for 'findAllInstitution' in namespace '/institution'Error creating bean with name 'com.institution.action.InstitutionAction': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.institution.action.InstitutionAction.setIm(com.institution.service.InstitutionManage); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'institutionManage': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.institution.service.InstitutionManage.setDao(com.dao.IDao); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.dao.Dao.setHibernateTemplate(org.springframework.orm.hibernate3.HibernateTemplate); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager
      

  3.   

    你的bean名称是不是有问题啊?,。。还是没写对?大小写什么的
      

  4.   

    你在form表单的action属性值前面加上"/项目名/findAllInstitution.do?oper=..."
      

  5.   

    你的bean名称是不是有问题啊?,。。还是没写对?大小写什么的
    我在Dao和Service中都用了@autowired,还需要在XML中写bean吗?
      

  6.   

    我在form表单的action属性值前面加上"命名空间的名字/findAllInstitution.do?oper=..."
    没有报错呀?
      

  7.   

    有没有把action交给hibernate管理?
      

  8.   

    我用的@Action,怎样交给Hibernate管理?
      

  9.   

    在action类里写了@Action,还需要在Struts.xml里配置吗?