org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for

org.springframework.jdbc.UncategorizedSQLException: Hibernate

operation: Cannot open connection; uncategorized SQLException for

SQL [???]; SQL state [null]; error code [0]; Cannot load JDBC

driver class 'com.mysql.jdbc.Driver'; nested exception is

org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver

class 'com.mysql.jdbc.Driver'

org.springframework.jdbc.support.AbstractFallbackSQLExceptionTransl

ator.translate(AbstractFallbackSQLExceptionTranslator.java:83)

org.springframework.jdbc.support.AbstractFallbackSQLExceptionTransl

ator.translate(AbstractFallbackSQLExceptionTranslator.java:80)

org.springframework.jdbc.support.AbstractFallbackSQLExceptionTransl

ator.translate(AbstractFallbackSQLExceptionTranslator.java:80)

org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAcc

essException(HibernateAccessor.java:424)

org.springframework.orm.hibernate3.HibernateAccessor.convertHiberna

teAccessException(HibernateAccessor.java:410)

org.springframework.orm.hibernate3.HibernateTemplate.doExecute

(HibernateTemplate.java:424)

org.springframework.orm.hibernate3.HibernateTemplate.executeWithNat

iveSession(HibernateTemplate.java:374)
 org.springframework.orm.hibernate3.HibernateTemplate.save

(HibernateTemplate.java:694)
 cn.edu.bjtu.SEIE.dao.impl.UserDAOImpl.insert

(UserDAOImpl.java:13)
 cn.edu.bjtu.SEIE.service.impl.UserServiceImpl.addUser

(UserServiceImpl.java:19)
 cn.edu.bjtu.SEIE.actions.impl.UserActionImpl.userRegister

(UserActionImpl.java:15)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke

(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke

(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)

com.opensymphony.xwork2.DefaultActionInvocation.invokeAction

(DefaultActionInvocation.java:441)

com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly

(DefaultActionInvocation.java:280)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:243)

com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIn

tercept(DefaultWorkflowInterceptor.java:165)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.interce

pt(MethodFilterInterceptor.java:87)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept

(ValidationInterceptor.java:252)

org.apache.struts2.interceptor.validation.AnnotationValidationInter

ceptor.doIntercept(AnnotationValidationInterceptor.java:68)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.interce

pt(MethodFilterInterceptor.java:87)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.inte

rcept(ConversionErrorInterceptor.java:122)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ParametersInterceptor.doInterce

pt(ParametersInterceptor.java:195)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.interce

pt(MethodFilterInterceptor.java:87)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ParametersInterceptor.doInterce

pt(ParametersInterceptor.java:195)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.interce

pt(MethodFilterInterceptor.java:87)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.int

ercept(StaticParametersInterceptor.java:179)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

org.apache.struts2.interceptor.MultiselectInterceptor.intercept

(MultiselectInterceptor.java:75)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

org.apache.struts2.interceptor.CheckboxInterceptor.intercept

(CheckboxInterceptor.java:94)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

org.apache.struts2.interceptor.FileUploadInterceptor.intercept

(FileUploadInterceptor.java:235)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercep

t(ModelDrivenInterceptor.java:89)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.in

tercept(ScopedModelDrivenInterceptor.java:130)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

org.apache.struts2.interceptor.debugging.DebuggingInterceptor.inter

cept(DebuggingInterceptor.java:267)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept

(ChainingInterceptor.java:126)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept

(PrepareInterceptor.java:138)

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.interce

pt(MethodFilterInterceptor.java:87)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept

(I18nInterceptor.java:165)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

org.apache.struts2.interceptor.ServletConfigInterceptor.intercept

(ServletConfigInterceptor.java:164)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept

(AliasInterceptor.java:179)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)

com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.int

ercept(ExceptionMappingInterceptor.java:176)
 com.opensymphony.xwork2.DefaultActionInvocation.invoke

(DefaultActionInvocation.java:237)
 org.apache.struts2.impl.StrutsActionProxy.execute

(StrutsActionProxy.java:52)
 org.apache.struts2.dispatcher.Dispatcher.serviceAction

(Dispatcher.java:488)
 org.apache.struts2.dispatcher.FilterDispatcher.doFilter

(FilterDispatcher.java:395)

org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter

(ActionContextCleanUp.java:102)


root cause

org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver

class 'com.mysql.jdbc.Driver'
 org.apache.commons.dbcp.BasicDataSource.createDataSource

(BasicDataSource.java:1136)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

解决方法:

原来用的mysql的jar包为5.1.XXX版本;org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for_第1张图片

去掉之;

 

换成5.0.XXX版本;org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for_第2张图片

注意版本问题&&&&&&&&&&&&&&&&&&&&&&

 

你可能感兴趣的:(编程心得,hibernate,jdbc,exception,nested,mysql,class)