日期:2014-05-19  浏览次数:20690 次

求教关于hibernate ,struts2, 连接数据库时的问题?
新手弄了好长时间了,问题是这样的,我用hibernate单独的去连数据库没有问题,单独用struts2时class.forname连接数据库时也没有问题,但是当我用struts2转到一个类里面然后用hibernate连数据库时他就一直连不上,而且hibernate执行带下面最后一句话后就不执行了(红色的是控制台输出的,绿色的是网页输出的),弄了一天了,感谢您的帮忙

484450 [http-8080-3] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
484450 [http-8080-3] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
484466 [http-8080-3] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
484468 [http-8080-3] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : linpeng/cl/User.hbm.xml
484471 [http-8080-3] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
484478 [http-8080-3] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
484479 [http-8080-3] INFO org.hibernate.cfg.HbmBinder - Mapping class: linpeng.cl.User -> users
484485 [http-8080-3] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
484536 [http-8080-3] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
484537 [http-8080-3] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
484537 [http-8080-3] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
484537 [http-8080-3] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
484537 [http-8080-3] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.microsoft.sqlserver.jdbc.SQLServerDriver at URL: jdbc:sqlserver://localhost:1433;databaseName=Test
484537 [http-8080-3] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=sa, password=****}



Struts Problem Report

Struts has detected an unhandled exception:

Messages:
com.microsoft.jdbc.base.BaseDatabaseMetaData.getDatabaseMajorVersion()I
File: org/hibernate/cfg/SettingsFactory.java
Line number: 116
Stacktraces

java.lang.reflect.InvocationTargetException
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.la