zoukankan      html  css  js  c++  java
  • SpringBoot踩坑日记

    1.Closing JPA EntityManagerFactory for persistence unit 'default'错误导致springboot启动后终止

    ------------------->

    2019-01-22 17:18:34.941  INFO 42978 --- [      Thread-13] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
    2019-01-22 17:18:34.945  INFO 42978 --- [      Thread-13] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
    2019-01-22 17:18:35.181  INFO 42978 --- [      Thread-13] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
    
    解决办法

    在依赖中添加spring-boot-starter-web
    例如Gradle在build.gradle中添加

    implementation 'org.springframework.boot:spring-boot-starter-web'
    

    问题解决
    <------------------- 2019.1.22

    2.Gradle加载依赖很慢,换成国内源

    --------------->

    repositories {
        //使用国内源下载依赖
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        mavenCentral()
    }
    

    替换之后重新Gradle下
    <----------------2019-01-23

    3.Gradle加载出错,错误如下

    startup failed:
    build file '/Users/cuifuan/workspaces/springcloud-tools/tools-eureka/build.gradle': 4: all buildscript {} blocks must appear before any plugins {} blocks in the script
    
    See https://docs.gradle.org/5.0/userguide/plugins.html#sec:plugins_block for information on the plugins {} block
    
     @ line 4, column 1.
       buildscript {
       ^
    
    1 error
    
    Open File
    

    经过一番排查

    //删去下面代码,如果存在,我也不知道为什么
    plugins {
        id 'java'
    }
    

    4.feign依赖不存在

    feign 声明式调用
    Feign makes writing java http clients easier

    之前安装依赖

    dependencies{
        compile "org.springframework.cloud:spring-cloud-starter-feign"
        compile "org.springframework.cloud:spring-cloud-starter-eureka"
    }
    

    springboot2.0之后

    dependencies {
        implementation "org.springframework.cloud:spring-cloud-starter-openfeign"
        implementation 'org.springframework.cloud:spring-cloud-starter-eureka-server'
    }
    

    5. com.netflix.client.ClientException: Load balancer does not have available server for client: sp

    build.gradle

    dependencies {
        implementation "org.springframework.cloud:spring-cloud-starter-openfeign"
    //应是eureka-client
        implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
    }
    

    6.解决报错 javax.persistence.TransactionRequiredException: Executing an update/delete query

    运行报错原因:少了一个注解:@Transactional : 要求开启事物管理

  • 相关阅读:
    java连接mysql数据库
    在多分类任务实验中用torch.nn实现dropout
    在多分类任务实验中手动实现实现dropout
    Ubuntu 20.04 使用参考博客
    多分类任务中不同隐藏单元个数对实验结果的影响
    多分类任务中不同隐藏层层数对实验结果的影响
    利用torch.nn实现前馈神经网络解决 多分类 任务使用至少三种不同的激活函数
    利用torch.nn实现前馈神经网络解决 二分类 任务
    torch.nn.BCELoss用法
    写了个小爬虫,为何用上代理ip总是出现错误。
  • 原文地址:https://www.cnblogs.com/cvandy/p/10304925.html
Copyright © 2011-2022 走看看