springboot 闪退。falling back to default profiles: default StandardService - Stopping service [Tomcat]

20 篇文章 1 订阅
16 篇文章 1 订阅

大家好,我是烤鸭:

      今天分享一个springboot 闪退的问题。确切得说是没有起来。

环境:

      springboot 版本 2.1.0.RELEASE

 

异常:

2019-05-25 19:39:00.822 ==> [main] ==> INFO  com.cgmanage.migrate.MigrateApplication - Starting MigrateApplication v1.0.0-SNAPSHOT on localhost with PID 27493 (/opt/web_app/data_migrate/test-1.0.0.jar started by root in /opt/web_app/data_migrate)
2019-05-25 19:39:00.827 ==> [main] ==> DEBUG com.cgmanage.migrate.MigrateApplication - Running with Spring Boot v2.1.0.RELEASE, Spring v5.1.2.RELEASE
2019-05-25 19:39:00.830 ==> [main] ==> INFO  com.cgmanage.migrate.MigrateApplication - No active profile set, falling back to default profiles: default
2019-05-25 19:39:04.153 ==> [main] ==> INFO  org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8085"]
2019-05-25 19:39:04.172 ==> [main] ==> INFO  org.apache.catalina.core.StandardService - Starting service [Tomcat]
2019-05-25 19:39:04.172 ==> [main] ==> INFO  org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/9.0.12
2019-05-25 19:39:04.195 ==> [main] ==> INFO  org.apache.catalina.core.AprLifecycleListener - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
2019-05-25 19:39:04.346 ==> [main] ==> INFO  o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2019-05-25 19:39:04.620 ==> [main] ==> INFO  org.apache.catalina.core.StandardService - Stopping service [Tomcat]

主要在于这两行:

    No active profile set, falling back to default profiles: default
    org.apache.catalina.core.StandardService - Stopping service [Tomcat]

解决方案:

      网上说的是添加 springboot-web 的依赖,但是没用。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

降低springboot 版本至 2.0.5.RELEASE ,还是不行。
同样的项目,测试环境可以跑起来,生产环境闪退,唯一的区别在于启动时指定的配置文件不同。
仔细对比配置文件,发现确实有个地方不一样。

测试环境的配置文件:

server:
  port: 8085
spring:
  application:
    name: test-migrate
  datasource:
    write:
      jdbc-url: jdbc:mysql://localhost:3306/test?useSSL=false&allowMultiQueries=true&useUnicode=true&characterEncoding=utf8
      username: root
      password: root
      driver-class-name: com.mysql.jdbc.Driver
      type: com.zaxxer.hikari.HikariDataSource
      idleTimeout: 180000
      connectionTimeout: 180000
      validationTimeout: 6000
      maxPoolSize: 200
      minIdle: 100

生产的配置文件比测试少了一行。
idleTimeout: 180000

没错。就差这一行。
如果你也是跟我有一样的问题,
日志打印也没报错的话。
建议
检查一下配置文件,仔细对比一下。。。surprise

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

烤鸭的世界我们不懂

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值