org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties': Initialization of bean failed; nested exception is java.lang.IllegalStateException: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1acf9e76 has been closed already

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eurekaInstanceConfigBean' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.class]: Unsatisfied dependency expressed through method 'eurekaInstanceConfigBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inetUtils' defined in class path resource [org/springframework/cloud/commons/util/UtilAutoConfiguration.class]: Unsatisfied dependency expressed through method 'inetUtils' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'inetUtilsProperties' defined in class path resource [org/springframework/cloud/commons/util/UtilAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152 has been closed already

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: HikariDataSource HikariDataSource (HikariPool-1) has been closed.
### The error may exist in  Mapper.java (best guess)
### The error may involve  Mapper.findAllToE 
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: HikariDataSource HikariDataSource (HikariPool-1) has been closed.

我使用的是一个纯  org.springframework.scheduling.annotation.Scheduled 的任务..但是每次执行都报错..

解决办法:配置文件添加端口号

如:

server:
port: ${SERVER_PORT:9190} #首先取环境变量,如果环境变量中没有,就取 9190 这个固定值

我估计这个错误的原因是:

因为你的代码里没有controller,没有服务端口..springboot 以为不会被外部调用.而释放了资源..

port: ${SERVER_PORT:9190} #首先取环境变量,如果环境变量中没有,就取 9190 这个固定值的更多相关文章

  1. DEDE把变量放进session中,结果取值为null的问题

    最近在基于织梦CMS(dedecms)做公司网站,可以说改动不少,而其中最令我印象深刻的就是织梦的session.    自己想在前台页面限制一些用户的访问,且后台用户可以访问.必须验证织梦后台用户的 ...

  2. Shell变量之自定义变量、环境变量

    1:环境变量        环境变量可以帮我们达到很多功能-包括家目录的变换啊.提示字符的显示啊.运行文件搜寻的路径啊等等的那么,既然环境变量有那么多的功能,问一下,目前我的 shell 环境中, 有 ...

  3. Java环境变量-Linux环境

    环境变量说明 JAVA_HOME 它指向jdk的安装目录,Eclipse/NetBeans/Tomcat等软件就是通过搜索JAVA_HOME变量来找到并使用安装好的jdk. PATH 作用是指定命令搜 ...

  4. postman使用之四:切换环境和设置读取变量

    postman提供了environment管理功能,想要在多个环境中测试,比如在测试环境.灰度环境.生产环境等,只需要用同样的接口,切换下环境即可,非常方便.具体步骤: 切换环境 1.点击界面右上角的 ...

  5. Shell 编程基础之变量和环境变量

    一.变量赋值和引用 Shell 编程中,使用变量无需事先声明,同时变量的命名不惜遵循如下规则: 首个字符必须为字母(a-z,A-Z)或者_ 变量名中间不能有空格,可以使用_连接 不能使用其他表达符号 ...

  6. [Shell]Bash变量:环境变量的配置文件和登录信息

    ----------------------------------------------------------------------------------------- 只有把环境变量放入配 ...

  7. linux环境变量与本地变量

    两者不同的是. 环境变量可以在shell的子进程中使用, 而本地变量不同. 每当连接上服务器时,服务器就会通过帐号密码运行一个SHELL,我们所做的工作都在这个SHELL上,特殊方法除外(如,守护进程 ...

  8. iOS开发环境C语言基础 变量 、 数据类型和变量赋值 、 其他 、 运算符

    1 变量使用常用错误汇总 1.1 问题 在我们使用变量的过程中,会遇到一些问题,在此将这些问题进行汇总,在今后使用的过程中,不出错.即使出现错误也可以很快地找到问题所在. 1.2 方案 变量在使用的过 ...

  9. 玩转变量、环境变量以及数学运算(shell)

    变量和环境变量    var=value  给变量赋值,输出语句:$ echo $var或者是$ echo ${var},记住中间有个空格 例如:name="coffee" age ...

  10. windows环境下nutch2.x 在eclipse中实现抓取数据存进mysql详细步骤

    nutch2.x 在eclipse中实现抓取数据存进mysql步骤 最近在研究nutch,花了几天时间,也遇到很多问题,最终结果还是成功了,在此记录,并给其他有兴趣的人提供参考,共同进步. 对nutc ...

随机推荐

  1. python skimage图像处理(三)

    python skimage图像处理(三) This blog is from: https://www.jianshu.com/p/7693222523c0  霍夫线变换 在图片处理中,霍夫变换主要 ...

  2. BaiduPCS-Go的安装及使用

    BaiduPCS-Go的安装及使用 linux下会提示输入验证码,浏览器打开验证码url,多输入几次 Contents [hide] 一. 软件下载及安装 二. 软件的使用 1. 账号登录与退出 2. ...

  3. 如何单独编译Linux内核源码中的驱动为可加载模块?

    答: 分为两步: 1. 配置某个驱动为模块(如: CONFIG_RTC_XXX=m) 2. 指定路径并编译, 如编译drivers/rtc中的驱动 make SUBDIRS=drivers/rtc m ...

  4. iOS项目运行出现:[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object

    说白了就是 字典初始化 的时候 放入空的值了 下面这个比较具体 错误原因: NSDictionary *dic = @{@"key":value}这个初始化方法,发现keys co ...

  5. js比较时间大于6个月

    //mons是比较的月数,如 2019-02-01 14:27:08 - 2019-08-01 14:27:08 function compareTime(mons,stTime,endTime){ ...

  6. Linux部署springboot项目,两种方式

    部署jar包(官方推荐) 在linux服务器上运行Jar文件时通常的方法是: $ java -jar test.jar 这种方式特点是ssh窗口关闭时,程序中止运行.或者是运行时没法切出去执行其他任务 ...

  7. c++ 二进制方式读取文件 读取特殊类型数据

    #include <iostream> #include <fstream> using namespace std; /* 二进制方式进行读写文件,可以读写 各种各样数据类型 ...

  8. jstree:重新加载数据集,刷新树

    true:表示获得一个已经存在的jstree实例 $('#tree').jstree(true).destroy();// 清除树节点 // 重新设置树的JSON数据集 $('#tree').jstr ...

  9. F# 4.6 预览版正式公布

    1月24日,F# 4.6 预览版正式公布,与以往一样,新版本的设计与开发过程是整个 F# 开源社区共同努力的结果,这次更新的具体讨论内容可以通过下面两个链接来查看: F# 4.6 意见征求记录 FSh ...

  10. Difference between java.lang.RuntimeException and java.lang.Exception

    In Java, there are two types of exceptions: checked exceptions and un-checked exceptions. A checked ...