日期:2014-05-16 浏览次数:20895 次
我在Weblogic配了Mysql的连接池,用的驱动包mysql-connector-java-3.0.15-ga-bin,下面是
? 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="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
? <property name="hibernate.connection.url">jdbc:mysql://liusp:3306;DatabaseName=test</property>
? <property name="hibernate.connection.usename">root</property>
? <property name="hibernate.connection.password">xxx</property>
? <property name="hibernate.connection.pool_size">1</property>
? <property name="show_sql">true</property>
? <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
?
? <mapping resource="com/stone/it/xanada/po/Cat.hbm.xml"/>
? </session-factory>
? </hibernate-configuration>
?
?
? 但运行提示我No suitable driver,请问是什么原因,我的驱动有问题,可在weblogci配置是成功的啊
? 把<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>改成
? <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>也不行
?
?
? 4:23,257 WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: 08001
? 4:23,257 ERROR JDBCExceptionReporter:46 - No suitable driver
? 4:23,257 ERROR JDBCExceptionReporter:38 - Cannot open connection
? .sql.SQLException: No suitable driver
? at java.sql.DriverManager.getConnection(DriverManager.java:532)
? at java.sql.DriverManager.getConnection(DriverManager.java:140)
? at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnec
? (DriverManagerConnectionProvider.java:95)
? at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278
?
? at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3264)
? at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3244)
? at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.ja
? 0)
? at net.sf.hibernate.transaction.JDBCTransactionFactory.beginTransaction(
? TransactionFactory.java:19)
? at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2
?
? at com.stone.it.delphi.Facade.getCat(Facade.java:84)
? at jsp_servlet.__control._jspService(__control.java:143)
? at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
? at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run