Hibernate报错解决问题
1.
java.lang.NoClassDefFoundError:org/hibernate/Session的异常
http://fehly.iteye.com/blog/621365
2.java.lang.NoClassDefFoundError:org/hibernate/Session
http://hi.baidu.com/052caimin/blog/item/18b31ded5d4205d3b31cb125.html
java.lang.NoClassDefFoundError:org/hibernate/Session
程序编译没错啊
写main测试是可以插入数据库的
通过界面注册信息然后用servlet调用插入方法就插不了了
错误原因:
hibernate3.jar只在eclipse的build_path里addexternaljar进去了
但是WEB-INF下要建立一个lib文件夹,把hibernate3.jar等所需要的jar包放进去才行!
3.java.lang.NoClassDefFoundError:org/apache/log4j/Level异常
http://topic.csdn.net/u/20110104/17/bb29e7f5-6304-476e-af66-2a53c97fd89d.html*log4j-1.2.15.jar这个包或者更高版本的...
4.%%%%ErrorCreatingSessionFactory%%%%
http://blog.csdn.net/jishijun204/archive/2007/12/09/1925910.aspx
org.hibernate.MappingException: duplicate property mapping: customer at org.hibernate.mapping.PersistentClass.checkPropertyDuplication(PersistentClass.java:414) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:404) at org.hibernate.mapping.RootClass.validate(RootClass.java:192) at org.hibernate.cfg.Configuration.validate(Configuration.java:984) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1169) at com.sily.hib.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:31) at com.sily.hib.dao.BaseHibernateDAO.getSession(BaseHibernateDAO.java:15) at com.sily.hib.dao.OrdersDAO.saveCustomerAndOrder(OrdersDAO.java:144) at com.sily.hib.dao.OrdersDAO.main(OrdersDAO.java:173) %%%% Error Creating SessionFactory %%%% org.hibernate.MappingException: Could not read mappings from resource: com/sily/hib/po/Usr.hbm.xml at org.hibernate.cfg.Configuration.addResource(Configuration.java:485) at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465) at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390) at org.hibernate.cfg.Configuration.configure(Configuration.java:1310) at com.sily.hib.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:69) at com.sily.hib.HibernateSessionFactory.getSession(HibernateSessionFactory.java:53) at com.sily.hib.dao.BaseHibernateDAO.getSession(BaseHibernateDAO.java:15) at com.sily.hib.dao.OrdersDAO.saveCustomerAndOrder(OrdersDAO.java:144) at com.sily.hib.dao.OrdersDAO.main(OrdersDAO.java:173) Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.sily.hib.po.Usr at org.hibernate.cfg.Mappings.addClass(Mappings.java:118) at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:154) at org.hibernate.cfg.Configuration.add(Configuration.java:386) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427) at org.hibernate.cfg.Configuration.addResource(Configuration.java:482) ... 10 more java.lang.NullPointerException at com.sily.hib.dao.OrdersDAO.saveCustomerAndOrder(OrdersDAO.java:146) at com.sily.hib.dao.OrdersDAO.main(OrdersDAO.java:173) end. 重复的属性映射关系.报的错是customer,其实不是customer.hbm.xml的配置重复,而是与cumstomer有映射关系的另一个orders.hbm.xml配置中出现了重复,把重复去掉就行了. 我的问题出现的原因:软件自动生成了映射关系, 而自己还去配置了一个, 所以出错了.出错的时候,是在做一对多的关系,所以说,当时是做的一个customer对应多个orders,在orders.hbm.xml中出现的重复是 <many-to-one name="customer" class="Customer" not-null="true" cascade="all"> <column name="customer_id"></column> </many-to-one> 这个语句写了俩次.去掉一个就行了.我想报的错应该就是红色的标记这个地方.
http://haiganghou.blog.sohu.com/86083386.html5.hibernate3.0org.hibernate.InvalidMappingException:Couldnotparsemappingdocument
http://topic.csdn.net/u/20090219/16/3c5b3b3a-0920-4705-99f8-0c4cc184a15b.html
6.org.hibernate.AssertionFailure:nullidinxxx.xx.xx的问题
http://tcrct.iteye.com/blog/690595
7.无法将mx.utils::ObjectProxy@32b2c11转换为mx.collections.ArrayCollection
http://blog.csdn.net/juny0302/archive/2009/07/17/4357844.aspx
TypeError:Error#1034:强制转换类型失败:无法将mx.utils::ObjectProxy@32b2c11转换为mx.collections.ArrayCollection。
初学flex,看了官方的视频,学着做了下,没想到出现以上错误。
查了n多网页最后发现是因为我的employee.xml文件只有一个employee的原因(为了省事只写了一条记录),再添加一条eployee,错误消失。
debug以下发现,如过只有1条记录的话类型是:mx.utils.ObjectProxy
而多条记录就是:mx.collections.ArrayCollection
为什么会这样目前还不知道。
8.java.lang.OutOfMemoryError:PermGenspace及其解决方法
http://blog.csdn.net/fengyie007/archive/2007/09/11/1780375.aspx
重启后解决...