hibernate.cfg.xml配置如下
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">
<![CDATA[
jdbc:mysql://localhost:3306/test
]]>
</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password" />
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">
net.sf.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.show_sql">true</property>
<mapping resource="Cat.hbm.xml"/>
</session-factory>
</hibernate-configuration>

解决方案 »

  1.   

    java.lang.NoClassDefFoundError: javax/transaction/Synchronization看第一行就知道了,你引包引错了,应该是hibernate的事务才对:net.sf.hibernate.transaction
      

  2.   

    不是其它的问题,很简单,你只需要将hibernate目录下lib下的jta.jar移到你的project中的lib下!
      

  3.   

    楼上的不要瞎指挥,你有仔细看他给的异常信息么?跟JAR包的位置没关系
      

  4.   

    to
    darkula(流浪街头的呆子) 
    什么叫瞎指挥?
    这种情况我也遇到过,请你用词恰当点好不好!我开始就是这个错误,一摸一样的错误,你不要瞎评论好不好,如果我说的不对你也可以不用理!
      

  5.   

    zhutouzip(Speak out!-shyboy):正解,谢谢darkula(流浪街头的呆子):谢谢