叫我刘五环的gravatar头像
叫我刘五环 2016-06-05 16:39:17

ssh框架为什么抛出异常:Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://localhost:3306/test'?

     Struts has detected an unhandled exception:

Messages:
  1. No suitable driver
  2. Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://localhost:3306/test'
  3. Could not open connection
File: java/sql/DriverManager.java
Line number: 278

 

搭建的ssh框架一直出现这个问题,我的数据库明明是连接上的。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
    xmlns:tx="http://www.springframework.org/schema/tx">


    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="url" value="jdbc:mysql://localhost:3306/test"></property>
        <property name="username" value="root"></property>
        <property name="password" value="root123@#$"></property>
    </bean>
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.MySQLDialect
                </prop>
            </props>
        </property>
        <property name="mappingResources">
            <list>
                <value>po/User.hbm.xml</value>
            </list>
        </property>
    </bean>
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <tx:annotation-driven transaction-manager="transactionManager" />
    
    <!-- 定义BeanNameAutoProxyCreator-->
    <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
        <!--  指定对满足哪些bean name的bean自动生成业务代理 -->
        <property name="beanNames">
            <!--  下面是所有需要自动创建事务代理的bean-->
            <list>
                <value>userService</value>
            </list>
            <!--  此处可增加其他需要自动创建事务代理的bean-->
        </property>
        
        <!--  下面定义BeanNameAutoProxyCreator所需的事务拦截器-->
    </bean>    
    <bean id="userDao"
        class="dao.impl.UserDaoImpl" abstract="false"
        lazy-init="default" autowire="default">
        <property name="sessionFactory">
            <ref local="sessionFactory" />
        </property>
    </bean>
    <bean id="userService"
        class="service.impl.UserServiceImpl"
        abstract="false" lazy-init="default" autowire="default"
        >
        <property name="userDao">
            <ref local="userDao" />
        </property>
    </bean>
</beans>

 

求大家告诉我这是个什么情况,要疯。谢谢

所有回答列表(2)
最代码官方的gravatar头像
最代码官方  LV167 2016年6月5日

mysql jdbc的jar包版本问题吧?

yjx4510013的gravatar头像
yjx4510013  LV9 2016年6月7日

mysql jdbc的jar包可有引入?

顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友