我是靠谱客的博主 感动飞机,最近开发中收集的这篇文章主要介绍【springboot】06_系统启动,数据库报错没有url,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

2022-06-24 10:42:26.260  INFO 40840 --- [           main] com.siemens.mocker.MockerApp             : Starting MockerApp on md60278c with PID 40840 (D:codejavaProjectspindle_mocker_backendtargetclasses started by z003nujf in D:codejavaProjectspindle_mocker_backend)
2022-06-24 10:42:26.263  INFO 40840 --- [           main] com.siemens.mocker.MockerApp             : No active profile set, falling back to default profiles: default
2022-06-24 10:42:28.378  INFO 40840 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-06-24 10:42:28.388  INFO 40840 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-06-24 10:42:28.388  INFO 40840 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.41]
2022-06-24 10:42:28.504  INFO 40840 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-06-24 10:42:28.504  INFO 40840 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2165 ms
2022-06-24 10:42:28.627  INFO 40840 --- [           main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2022-06-24 10:42:28.733  WARN 40840 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mockDataController': Unsatisfied dependency expressed through field 'mockDataService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MockDataService': Unsatisfied dependency expressed through field 'mockWorkerService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MockWorkerService': Unsatisfied dependency expressed through field 'deviceFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DeviceFactory': Unsatisfied dependency expressed through field 'typeServiceMap'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DeviceMockerService': Unsatisfied dependency expressed through field 'deviceInfoService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'DeviceInfoService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deviceInfoDao' defined in file [D:codejavaProjectspindle_mocker_backendtargetclassescomsiemensmockerdaoDeviceInfoDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.class]: Invocation of init method failed; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2022-06-24 10:42:28.733  INFO 40840 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-06-24 10:42:28.867  INFO 40840 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-06-24 10:42:28.867 ERROR 40840 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


Process finished with exit code 1

在这里插入图片描述

判断数据库版本以及各式是否正确

#mysql8以下的版本,请检查pom.xml文件种依赖的mysql jar包的版本
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&useSSL=false
 
 

#mysql8的版本
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai

系统未加载到配置文件

项目没有加载到yml或者properties文件,特别是自己的pom打包是jar的项目,请查看自己的pom.xml文件中的packaging。
步骤1
jar
如果pom中指定使用jar,系统不会自动读取到yml或者properties文件的,需要我们手动配置pom.xml。
步骤2.

    <build>

        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.yaml</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.yaml</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

最后

以上就是感动飞机为你收集整理的【springboot】06_系统启动,数据库报错没有url的全部内容,希望文章能够帮你解决【springboot】06_系统启动,数据库报错没有url所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部