unkow jdbc driver : http://maven.apache.org

08-06 14:20:47-[ERROR] [druid.pool.DruidDataSource] dataSource init error
java.sql.SQLException: unkow jdbc driver : http://maven.apache.org
  at com.alibaba.druid.util.JdbcUtils.getDriverClassName(JdbcUtils.java:430)
  at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:591)
  at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:934)
  at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:930)
  at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:102)
  at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
  at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
  at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:84)
  at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:70)
  at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:337)
  at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:84)
  at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
  at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)

1 看看数据源的配置是否有问题。

<bean name="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
    <property name="url" value="${url}" />
    <property name="username" value="${user}" />
    <property name="password" value="${password}" />
    <property name="initialSize" value="2" />
    <property name="maxActive" value="20" />
    <property name="minIdle" value="2" />
    <property name="maxWait" value="60000" />
</bean>

2 导包是否有问题。

3 但是在我的这个代码中,在数据源配的url,他最后取得的值是 我在pom.xml里配置的url <url>http://maven.apache.org</url>,主要我不知道他是怎么去得到这个值的!

  两种修改方面:

   1 修改数据源配置文件

   <property name="url" value="${jdbc_url}" />
   <property name="username" value="${jdbc_user}" />
   <property name="password" value="${jdbc_password}" />

 2 去掉pom.xml配置里的<url>

4 之前代码没该过,也是可以运行的~~~(就突然出现这个问题了)

 

posted @ 2018-08-06 14:47  NAYNEHC  阅读(1549)  评论(0编辑  收藏  举报