• 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 : 要求开启事物管理

  • 相关阅读:
    弱引用的字典WeakDictionary(转)
    XBox360调试程序失败:Unable to start debugging.Connection to Xbox360 development kit lost
    托管C++中的范型和模板的区别
    智能指针的缺陷
    托管C++笔记(二)原创
    C#通过WMI操作本地共享文件夹
    很随便的随笔
    "The system cannot execute the specified program"
    C++多重继承
    托管C++笔记(一)原创
  • 原文地址:https://www.cnblogs.com/cvandy/p/10304925.html
Copyright © 2020-2023  润新知