SSH整合时,一直不成功,出现如下错误,错误太多了,不知道怎么改.
我用spring和hibernate整合时,用junit测试,一点没错,但是加入struts2时,出现了太多错误了,大家看看吧!在线等待!首先加入struts2的jar时...
我用spring和hibernate整合时,用junit测试,一点没错,但是加入struts2时,出现了太多错误了,大家看看吧!在线等待!
首先加入struts2的jar时,运行junit就会出现问题了:如:
警告: Failed to classload type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable.
java.lang.ClassNotFoundException: org.testng.annotations.BeforeTest
java.lang.ClassNotFoundException: org.testng.annotations.AfterTest
然后配置Struts后,运行:会出现:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [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 class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.AnnotationConfiguration]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.hibernate.annotations.common.reflection.java.JavaReflectionManager cannot be cast to org.hibernate.annotations.common.reflection.MetadataProviderInjector 展开
首先加入struts2的jar时,运行junit就会出现问题了:如:
警告: Failed to classload type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable.
java.lang.ClassNotFoundException: org.testng.annotations.BeforeTest
java.lang.ClassNotFoundException: org.testng.annotations.AfterTest
然后配置Struts后,运行:会出现:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [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 class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.AnnotationConfiguration]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.hibernate.annotations.common.reflection.java.JavaReflectionManager cannot be cast to org.hibernate.annotations.common.reflection.MetadataProviderInjector 展开
2个回答
2012-03-25
展开全部
项目发过来 qq 892653986
2012-03-25
展开全部
注解信息缺失,现在的新版都是靠注解来达到配置的功用。
更多追问追答
追问
说详细点,新手,哪的注解缺失啊 ,我都注解了啊,用junit测试spring和hibernate成功,加入struts就不行了
追答
Error creating bean with name 'userDao': Injection of resource dependencies failed;
userDao,这个Bean无法初始化,导致依赖注入失败。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询