记录hibernate 3学习过程中的报错(未完成)

类别:Java 点击:0 评论:0 推荐:

1。解压缩hibernate-3.0beta1.zip文件
2。copy msbase.jar,msutil.jar,mssqlserver.jar文件到hibernater-3.0/lib目录下
3。编辑etc/hibernate.properties(不在src目录下)。如下:
4。运行 hibernater-3.0/builder eg
报错如下:
 org.hibernate.HibernateException: could not instantiate CacheProvider: net.sf.hibernate.cache.HashtableCache.Provider

吃亏了:hibernate2.jar和hibernate3.jar包结构完全不同了
例如:hibernate2中的net.sf.hibernate.dialect.SQLServerDialect
在hibernater3中变成了org.hibernate.dialect.SQLServerDialect


报错说:class not found : org.hsqldb.jdbcDriver
在build.xml文件中发现以下这句话:
<echo message="remember to place your JDBC driver in the lib directory"/>
将hsqldb.jar文件拷贝到hibernater-3.0/lib目录下。

在hibernate.properties文件中写
hibernate.dialect org.hibernate.dialect.SQLServerDialect
hibernate.connection.username spitrade
hibernate.connection.password spitechnhm

hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
hibernate.connection.url jdbc:microsoft:sqlserver://218.244.111.84:1433;DatabaseName=spitrade;SelectMethod=cursor

去除HypersonicSQL的连接方法,好像成功连接了。

怎么去建立数据库?用Main方法去建立失败,
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/Session

java org.hibernate.auction.Main
缺少classpath cglib.jar hibernate3.jar ehcache.jar commons-collections-2.1.1.jar

set classpath后
报错说:Not binding factory to JNDI, no JNDI name configured


http://www.hibernate.org/114.html ---->  Using Hibernate with Tomcat and JNDI


hibernate.connection.datasource jdbc/soos  失败
可能需要修改hibernate.cfg.xml文件 并增加jta.jar

hibernate.properties not found
将hibernate.properties文件放入classpath找得到的地方 成功。

Could not find datasource: java:comp/env/jdbc/soos
在hibernate.properties中必须写hibernate.connection.datasource jdbc/soos

本文地址:http://com.8s8s.com/it/it12182.htm