当前位置:编程学习 > JAVA >>

Spring+Hibernate 发布到Tomcat 一起动就报这个错求大神帮忙解决

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of resource fields failed; 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.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]



DAO层注入失败 嵌套的是SessionFactory,再嵌套org.hibernate.tuple.entity.PojoEntityTuplizer

配置,jar包 全检查过了 还是不能解决。 spring hibernate --------------------编程问答-------------------- 貌似没遇到过这个错误 --------------------编程问答-------------------- 配置文件看下先 --------------------编程问答-------------------- 我配置文件从另外个工程复制过来的。但就是他报错。然后我把原来的工程整个复制了过来,除了配置文件全删除了。还是这样的问题@@@@我也觉得是哪配置出错了。有大神可以帮我看一下么。q175428901 --------------------编程问答-------------------- ApplicationContext ac = new ClassPathXmlApplicationContext(
"applicationContext.xml");
SessionFactory sf = (SessionFactory) ac.getBean("sessionFactory");


2个工程都写了mian方法 包含以上代码。 可出错的还是出错 没问题的依旧没问题 --------------------编程问答-------------------- tuplizer这个类中有默认的构造函数没有? --------------------编程问答-------------------- 这个是hibernate3.jar 里面的 我已经换了好几个jar包了 还是不行。  另外2个工程 用到的部分完全一样  但就是有一个会报错...郁闷了 --------------------编程问答-------------------- 有没有javassist.jar? --------------------编程问答-------------------- 目测是配置文件错误 --------------------编程问答-------------------- LZ把错误信息全都贴出来吧


可能是某个实体类中有错导致的 --------------------编程问答-------------------- 还有可能是jar包冲突了 --------------------编程问答-------------------- Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer
---说明没有按照实体类实例化,导致这个错误.

没有实例化,请查看 hbm.xml中各个实体类的定义以及hibernate映射文件,看是否匹配?
比如 date 写成了 data或者类名错误等!

参考这个回答
http://blog.csdn.net/jjss2006/article/details/4470702 --------------------编程问答-------------------- 这个类  Tuplizer 的hbm映射文件 你贴出来看一下 
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,