专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Java Exception

spring使用dbcp类型的DataSource,数据库为mysql,老报异常: org.apache.commons.dbcp.SQLNestedException: Cannot cre

发布时间:2010-06-05 12:34:27 文章来源:www.iduyao.cn 采编人员:星星草

spring的配置文件为:
  <beans>
  <bean id="dataSource"
  class="org.apache.commons.dbcp.BasicDataSource"
  destroy-method="close">
  <property name="driverClassName">
  <value>com.mysql.jdbc.Driver</value>
  </property>
  <property name="url">
  <value>
  jdbc:mysql://localhost:3306/test
  </value>
  </property>
  <property name="username">
  <value>root</value>
  </property>
  <property name="password">
  <value>123</value>
  </property>
  </bean>
  <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
  <ref local="dataSource" />
  </property>
  <property name="mappingResources">
  <list>
  <value>com/gyf/hibernate/UserBasicinfo.hbm.xml</value>
  <value>com/gyf/hibernate/UserStateinfo.hbm.xml</value>
  </list>
  </property>
  <property name="hibernateProperties">
  <props>
  <prop key="hibernate.dialect">
  org.hibernate.dialect.MySQLDialect
  </prop>
  <prop key="hibernate.show_sql">
  true
  </prop>
  </props>
  </property>
  </bean>
  <bean id="transactionManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory">
  <ref local="sessionFactory" />
  </property>
  </bean>
  <bean id="userDAO" class="com.gyf.dao.UserDAO">
  <property name="sessionFactory">
  <ref local="sessionFactory" />
  </property>
  </bean>
  <bean id="userDAOProxy"
  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
  <property name="transactionManager">
  <ref bean="transactionManager" />
  </property>
  <property name="target">
  <ref local="userDAO" />
  </property>
  <property name="transactionAttributes">
  <props>
  <prop key="insert*">PROPAGATION_REQUIRED</prop>
  <prop key="get*">
  PROPAGATION_REQUIRED,readOnly
  </prop>
  </props>
 
  </property>
  </bean>
  </beans>
  ------------------
  可我现在什么都配置好了,但运行测试代码报错:
  2005-10-18 15:47:30,882 INFO (ConnectionProviderFactory.java:53) - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
  2005-10-18 15:47:30,929 DEBUG (JDBCExceptionReporter.java:63) - SQL Exception
  org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL '
  jdbc:mysql://localhost:3306/test
  '     

友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: