大家好,我在整合SSH框架时 保存数据时一提交就报下面的错误,请大家指导一下 ,spring 2.5,hibernate3.2,structs2,用的mysql,jar包是mysql-connector-java-5[1].0.3-bin.jar,报错如下:
exception javax.servlet.ServletException: org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql://localhost:3306/mytest'; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql://localhost:3306/mytest'
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
root cause org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql://localhost:3306/mytest'; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql://localhost:3306/mytest'
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:120)
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:276)
org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:377)
org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:632)

解决方案 »

  1.   

    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???];1.好好检查下数据库名:mytest,注意大小写,s
    2.Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL,检查下URL是不是写对了。
    spring创建datasource异常啊。
      

  2.   

    检查下驱动相关信息,看看jar
      

  3.   

    url/ 数据库都是对的  jar包也是对的,不知道什么原因