eureka启动报错,请问怎么解决
来源:4-3 开发Eureka Server
Zarathustra1816763
2021-02-09 16:39:47
错误信息

***************************
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
pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>spring-cloud-practice</artifactId>
<groupId>com.imooc</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eureka-service</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
application.properties
spring.application.name=eureka-server
server.port=8000
eureka.instance.hostname=localhost
#fetch-registry:获取注册表。不需要同步其他节点数据。
eureka.client.fetch-registry=false
#register-with-eureka代表是否将自己注册到Eureka Server,默认是true。
eureka.client.register-with-eureka=false
eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/
application
package com.imooc.course;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@EnableEurekaServer
@SpringBootApplication
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
1回答
好帮手慕阿园
2021-02-09
同学你好,运行代码是可以正确启动的,如下

根据报错提示,配置数据源失败:未指定'url'属性,且无法配置嵌入式数据源。原因:未能确定合适的驱动程序类;但是该模块未配置数据源;
1、同学是否是启动的其他模块,建议同学检查下其他两个模块中数据库url的配置
2、如果不是,建议同学将pom.xml中的依赖删除后刷新下maven重新导入试试
3、如果还不可以,建议同学下载课程源码单独运行Eureka试试
祝学习愉快~
相似问题