1.问题:Exception in thread "main" java.lang.NoClassDefFoundError: org/dom4j/DocumentException
at HibernateTest.main(HibernateTest.java:14)
要领:添加dom4j.jar(理会hibernate.cfg.xml文件)
2.问题:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:116)
at HibernateTest.main(HibernateTest.java:14)
要领:添加commons-logging.jar(记录理会进程)
3.问题:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
要领:添加commons-collections.jar(在理会映射文件时,需要把所有耐久化工具的界说放在一个HashMap中)
4.问题:Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
要领:添加ehcache.jar(高速缓存,提高存取速度)
5.问题:2009-2-22 23:45:40 net.sf.ehcache.config.Configurator configure
告诫: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/F:/MyJava/Hibernate/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
Exception in thread "main" java.lang.NoClassDefFoundError
要领:把ehcache-1.1.jar解压,把个中的ehcache-failsafe.xml改成ehcache.xml。
6.问题:Caused by: java.lang.ClassNotFoundException: net.sf.cglib.transform.impl.InterceptFieldEnabled
要领:添加cglib-full-2.0.02.jar
7.问题:Caused by: java.lang.NoSuchMethodError: net.sf.cglib.proxy.Enhancer.setInterceptDuringConstruction(Z)V
要领:添加cglib-nodep-2.1_3.jar
8.问题:Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/Synchronization
要领:添加jta.jar(事务处理惩罚)
9.问题:Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException
要领:添加antlr-2.7.5h3.jar
10问题:Caused by: java.sql.SQLException: The statement (1) has no open cursor.
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2901)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:773)
要领: <!– <property name="jdbc.fetch_size">50 </property> –>
把上面这个属性按上面这样注释掉就可以了. (假如mysql-connector的版本早于3.2.1并且处事器的版本早于5.0.3,"setFetchSize()"是没有结果的.)