spring boot运行报错

spring boot运行报错

springboot 版本 2.0.6

配置文件
server:
port: 10086
eureka:
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://127.0.0.1:${server.port}/eureka/

启动类
@SpringBootApplication
@EnableEurekaServer
public class EurekaServer {
public static void main(String[] args) {
SpringApplication.run(EurekaServer.class, args);
}
}
父工程依赖



org.springframework.cloud
spring-cloud-dependencies
Finchley.SR4
pom
import


依赖

org.springframework.cloud
spring-cloud-starter-netflix-eureka-server

运行结果
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2019-09-07 09:36:32.749 ERROR 4400 — [ 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

网上查找资料说是启动springboot必须引入数据源,,,,以前也做过发送短信的微服务,没引入数据源,这个问题现在不明确,,以前的springboot是1.6的,,,还有网上说的在注解加上(exclude = DataSourceAutoConfiguration.class),问题依然存在

解决问题:
引入数据源
#spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/***?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: root
运行后报错
java.lang.TypeNotPresentException: Type javax.xml.bind.JAXBContext not present

因为JAXB-API是java ee的一部分,在jdk9中没有在默认的类路径中;

java ee api在jdk中还是存在的,默认没有加载而已,jdk9中引入了模块的概念,可以使用

模块命令–add-modules java.xml.bind引入jaxb-api;

(别人的,自己还看不懂)
地址::https://blog.csdn.net/qq_15807167/article/details/79346607

在pom文件引入

javax.xml.bind
jaxb-api
2.3.0


com.sun.xml.bind
jaxb-impl
2.3.0


org.glassfish.jaxb
jaxb-runtime
2.3.0


javax.activation
activation
1.1.1

问题解决
求大神指点 问题解决了但还是不懂问题所在
1.springboot启动必须引入数据源么?还是版本不同不同的配置?
2.只是简单的启动不需要数据库的。。。。那些依赖是干什么的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值