错误:弹簧引导数据库错误"org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration"



我正在使用spring-boot、hibernate和我的sql,我收到了错误。

org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为"org.springfframework.boot.autoconfig.orm.jpa.HHibernate JpaConfiguration"的bean时出错:通过构造函数参数0表示的不满足依赖关系;嵌套异常为org.springframework.beans.factory.BeanCreationException:创建类路径资源[org/springframeter/boot/autoconfig/jdbc/DataSourceConfiguration$Hikari.class]中定义的名称为"dataSource"的bean时出错:通过工厂方法实例化bean失败;嵌套异常为org.springframework.beans.BeanInstanceException:未能实例化[com.zaxxer.hikari.HikariDataSource]:工厂方法"dataSource"引发异常;嵌套异常为java.lang.IollegalStateException:无法加载驱动程序类:com.mysql.jdbc.driver位于org.springframework.beans.factory.support.ConstrutorResolver.createArgumentArray(ConstructorResolver.java:732)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]网址:org.springframework.beans.factory.support.ConstrutorResolver.autowireConstructor(ConstructorResolver.java:197)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:167)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1124)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]在org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]位于org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]网址:org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]网址:org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]位于org.springframework.beans.factory.support.ConstructureResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]在org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]位于org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]网址:org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]网址:org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]位于org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089)~[spring-context-5.09.REASE.jar:5.0.9.RELEASE]位于org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:859)~[spring-context-5.09.REASE.jar:5.0.9.RELEASE]位于org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)~[spring-context-5.09.REASE.jar:5.0.9.RELEASE]网址:org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplication context.java:140)~[spring-boot-2.0.5.REASE.jar:2.0.5.RELEASE]网址:org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780)[spring-boot-2.0.5.REASE.jar:2.0.5.RELEASE]网址:org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)[spring-boot-2.0.5.REASE.jar:2.0.5.RELEASE]网址:org.springframework.boot.SpringApplication.run(SpringApplication.java:333)[spring-boot-2.0.5.REASE.jar:2.0.5.RELEASE]网址:org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)[spring-boot-2.0.5.REASE.jar:2.0.5.RELEASE]网址:org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)[spring-boot-2.0.5.REASE.jar:2.0.5.RELEASE]网址:com.trial.TrialApplication.main(TrialApplication.java:15)[classes/:na]由:org.springframework.beans.factory.BeanCreationException:创建类路径资源[org/springframework/boot/autoconfig/jdbc/DataSourceConfiguration$Hikari.class]中定义的名称为"dataSource"的bean时出错:通过工厂方法实例化bean失败;嵌套异常为org.springframework.beans.BeanInstanceException:未能实例化[com.zaxxer.hikari.HikariDataSource]:工厂方法"dataSource"引发异常;嵌套异常为java.lang.IollegalStateException:无法加载驱动程序类:com.mysql.jdbc.driver位于org.springframework.beans.factory.support.ConstructureResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:590)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]在org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]位于org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]网址:org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]网址:org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]位于org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]位于org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]位于org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]位于org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:818)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]位于org.springframework.beans.factory.support.ConstructurerResolver.createArgumentArray(ConstructorResolver.java:724)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]…省略了28个常用帧由:org.springframework.beans.BeanInstanceException引起:未能实例化[com.zaxxer.hikari.HikariDataSource]:工厂方法"dataSource"引发异常;嵌套异常为java.lang.IollegalStateException:无法加载驱动程序类:com.mysql.jdbc.driver网址:org.springframework.beans.factory.support.SimpleInstantiationStrategy.instante(SimpleInstantiatonStrategy.java:185)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]位于org.springframework.beans.factory.support.ConstructureResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:582)~[spring-beans-5.0.9.REASE.jar:5.0.9.RELEASE]…省略了41个常用帧引起原因:java.lang.IllegalStateException:无法加载驱动程序类:com.mysql.jdbc.driver位于org.springframework.util.Assert.state(Assert.java:94)~[spring-core-5.09.REASE.jar:5.0.9.RELEASE]位于org.springframework.boot.autoconfig.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:224)~[spring-boot-autoconfig-2.0.5.REASE.jar:2.0.5.RELEASE]位于org.springframework.boot.autoconfig.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:176)~[spring-boot-autoconfigure-2.0.5.REASE.jar:2.0.5.RELEASE]位于org.springframework.boot.autoconfig.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:43)~[spring-boot-autoconfig-2.0.5.REASE.jar:2.0.5.RELEASE]位于org.springframework.boot.autoconfig.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:83)~[spring-boot-autoconfig-2.0.5.REASE.jar:2.0.5.RELEASE]在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)~[na:1.8.0_181]在sun.reflect.NativeMethodAccessorImpl.invoke(未知源)~[na:1.8.0_181]在sun.reflect.DelegatingMethodAccessorImpl.invoke(未知源)~[na:1.8.0_181]位于java.lang.reflect.Method.ioke(未知源)~[na:1.8.0_181]网址:org.springframework.beans.factory.support.SimpleInstantiationStrategy.instante(SimpleInstantiatonStrategy.java:154)~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELENSE]…42个普通帧省略

github存储库链接是https://github.com/dishankgoyal/springsBoot

我该怎么解决这个问题?

您的mysql jdbc jar似乎已损坏,因此无法加载驱动程序,建议清除您的项目或删除.m2存储库可能会有所帮助。

或者,如果maven项目更新没有帮助,重新启动system/IDE可能也会有所帮助。

或者,如果通过IDE手动添加了任何jar,那么重新安装IDE有时也会有所帮助。

我推荐这些,因为我在最后运行了你的项目,效果很好。

最新更新