zoukankan      html  css  js  c++  java
  • port: ${SERVER_PORT:9190} #首先取环境变量,如果环境变量中没有,就取 9190 这个固定值

    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 以为不会被外部调用.而释放了资源..

  • 相关阅读:
    面试题1:赋值运算符函数
    面试题:寻找热门查询
    面试题9:斐波那契数列
    Java中的volatile关键字
    二分查找算法
    面试题8:旋转数组的最小数字
    面试题:在O(1)空间复杂度范围内对一个数组中前后连段有序数组进行归并排序
    百度面试题:从海量日志中提取访问百度次数最多的IP
    面试总结
    java垃圾回收
  • 原文地址:https://www.cnblogs.com/suizhikuo/p/11128749.html
Copyright © 2011-2022 走看看