eureka启动报错,请问怎么解决

eureka启动报错,请问怎么解决

错误信息

http://img1.sycdn.imooc.com//climg/602249e40952294f09650178.jpg


***************************

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

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕阿园 2021-02-09 18:40:46

同学你好,运行代码是可以正确启动的,如下

http://img1.sycdn.imooc.com//climg/602263e70934ffed09090383.jpg

根据报错提示,配置数据源失败:未指定'url'属性,且无法配置嵌入式数据源。原因:未能确定合适的驱动程序类;但是该模块未配置数据源;

1、同学是否是启动的其他模块,建议同学检查下其他两个模块中数据库url的配置

2、如果不是,建议同学将pom.xml中的依赖删除后刷新下maven重新导入试试

3、如果还不可以,建议同学下载课程源码单独运行Eureka试试

祝学习愉快~


问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师