报错: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.cj.jdbc.Driver] Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.cj.jdbc.Driver] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1734) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1442) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:144) at org.springframework.context.support.ClassPathXmlApplicationContext. (ClassPathXmlApplicationContext.java:85) at com.hrbust.test.StuTest.main(StuTest.java:10) Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.cj.jdbc.Driver] 有道翻译:
在上下文初始化时遇到的异常-取消刷新尝试:org.springframework.beans.factory.BeanCreationException:创建在类路径资源[applicationContext.xml]中定义名为“dataSource”的bean时出错:设置属性值时出错;嵌套的异常是org.springframework.beans.PropertyBatchUpdateException;嵌套的PropertyAccessExceptions(1)是:
PropertyAccessException: org.springframework.bean . methodinvocationexception: Property 'driverClassName'抛出异常;嵌套异常是java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.cj.jdbc.Driver]
org.springframework.beans.factory.BeanCreationException:创建类路径资源[applicationContext.xml]中定义的名为“dataSource”的bean时出错:设置属性值时出错;嵌套的异常是org.springframework.beans.PropertyBatchUpdateException;嵌套的PropertyAccessExceptions(1)是:
PropertyAccessException: org.springframework.bean . methodinvocationexception: Property 'driverClassName'抛出异常;嵌套异常是java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.cj.jdbc.Driver]
因为jdbcTempate拼写错误
数据库版本问题
同样错误的人可以修改一下
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)