Spring开发踩坑记录
#1 @EnableEurekaServer无法正常import原因是spring-cloud-dependencies版本太低,改成高版本的Edgware.SR4即可。参考:https://www.cnblogs.com/zhuwenjoyce/p/9655940.html
<!-- 使用dependencyManagement进行版本管理 -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Edgware.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
#2 报错! java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;) 参考:https://www.cnblogs.com/syp172654682/p/9015057.html
是由于spring boot版本兼容性导致的,在pom.xml中修改配置文件,修改前:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
修改后:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
#3 报错! Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 参考:https://blog.csdn.net/lance521/article/details/77847278 和 https://blog.csdn.net/xyjcfucdi128/article/details/86595936 解决:需要在启动类的@SpringBootApplication中添加exclude = {DataSourceAutoConfiguration.class}
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
#4 报错! Parameter 3 of method eurekaRegistration in org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration required a 参考:https://blog.csdn.net/u013276512/article/details/81088966
少了一个配置“'eureka.client.healthcheck.enabled'”,于是在项目的 application.yml文件中添加了eureka.client.healthcheck.enabled=true,如下:
eureka:
client:
healthcheck:
enabled: true
#5 报错! Dependency 'org.csource:fastdfs-client-java:1.27-SNAPSHOT' not found 参考:https://www.jianshu.com/p/c39ca1ee222b
从 https://github.com/happyfish100/fastdfs-client-java 下载
git clone https://github.com/happyfish100/fastdfs-client-java.git # 进入下载好的fastdfs-client-java 解压 $ cd /fastdfs-client-java # 使用maven打包jar $ mvn clean install
构建完成后会自动把fastdfs-client-java-1.27-SNAPSHOT.jar安装到本地的Maven仓库
[INFO] Installing E:\cf\git\fastdfs-client-java-master\target\fastdfs-client-jav a-1.27-SNAPSHOT.jar to D:\Development\MavenRepository\org\csource\fastdfs-client -java\1.27-SNAPSHOT\fastdfs-client-java-1.27-SNAPSHOT.jar [INFO] Installing E:\cf\git\fastdfs-client-java-master\pom.xml to D:\Development \MavenRepository\org\csource\fastdfs-client-java\1.27-SNAPSHOT\fastdfs-client-ja va-1.27-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 25.148 s [INFO] Finished at: --15T10::+: [INFO] ------------------------------------------------------------------------
#6 报错!@SpringBootApplication used in default package 参考:https://blog.csdn.net/weixin_42323802/article/details/84561492 和 https://blog.csdn.net/qq544649790/article/details/83032497 在@springbootApplication 注解失效的情况下,推荐使用@CompentScan 和@EnableAutoConfiguration进行代替
修改前:
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
@SpringBootApplication
修改后:
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
@ComponentScan("com.dataplatform")
//@SpringBootApplication
#7 java: 程序包org.csource.fastdfs不存在,事实上已经在本地编译安装了fastdfs-client-java 参考:http://www.mamicode.com/info-detail-2329592.html 和 https://stackoverflow.com/questions/8150535/intellij-idea-indexed-maven-repositories-list-how-to-add-remote-maven-repos 先自己编译源码成jar本地安装到maven的本地仓库,选中项目的主pom.xml文件,右键Maven -> Open 'settings.xml',更新其中的信息为本地的库
#8 IllegalArgumentException: java.net.UnknownHostException: quickstart.cloudera 参考:https://blog.csdn.net/ganeshys2017/article/details/81360921 和 https://www.cnblogs.com/chenligeng/p/9347149.html 在hosts文件中配置主机名quickstart.cloudera对应的IP地址
#9 报错!repackage failed: Unable to find a single main class from the following candidates 报错!idea maven 只编译 不运行
未能针对性解决,但是重启后问题消失了!
#10 报错!NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.clearCache()V 参考:https://blog.csdn.net/ghhgc/article/details/81213566 和 https://blog.csdn.net/qq_42664961/article/details/83860119 解决方法:将spring-cloud-starter-openfeign的版本修改为和spring-cloud一致,如下所示
修改前:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>2.0.0.RC1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
修改后:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Spring开发踩坑记录的更多相关文章
- uni-app开发踩坑记录
大部分问题是我在h5端看不到而在android.iOS平台上暴露出来的,不包含小程序 1.:class="['defaultStyle', dynamicStyle]" 不支持直接 ...
- [转]微信小程序开发踩坑记录
本文转自:http://www.cnblogs.com/NKnife/p/6283605.html 1.由于小程序wx.request()方法是异步的,在app.js执行ajax后,各分页加载app. ...
- 微信小程序开发踩坑记录
1.由于小程序wx.request()方法是异步的,在app.js执行ajax后,各分页加载app.js的全局数据时,无法按顺序加载.例: //app.js App({ ajax:function() ...
- uniapp开发踩坑记录
数组绑定class的问题 版本:v1.5.4 自定义了一个icon的组件,部分代码如下 <template> <text :class="[name, icon]" ...
- wepy开发踩坑记录
与vue的不同 methods对象只存放tap等事件触发时的方法 events对象只存放$emit及$broadcast方法触发的事件 自定义方法及属性放在与methods平级的位置 props是动态 ...
- spring boot +dubbo 踩坑记录
今天初次搭建spring boot +duboo的demo.记录一下踩坑记录. 首先搭建3个小demo,一个maven项目,两个spring boot (服务提供者和服务消费者)项目. 两 sprin ...
- 你真的了解字典(Dictionary)吗? C# Memory Cache 踩坑记录 .net 泛型 结构化CSS设计思维 WinForm POST上传与后台接收 高效实用的.NET开源项目 .net 笔试面试总结(3) .net 笔试面试总结(2) 依赖注入 C# RSA 加密 C#与Java AES 加密解密
你真的了解字典(Dictionary)吗? 从一道亲身经历的面试题说起 半年前,我参加我现在所在公司的面试,面试官给了一道题,说有一个Y形的链表,知道起始节点,找出交叉节点.为了便于描述,我把上面 ...
- SpringBoot+SpringSecurity+Thymeleaf认证失败返回错误信息踩坑记录
Spring boot +Spring Security + Thymeleaf认证失败返回错误信息踩坑记录 步入8102年,现在企业开发追求快速,Springboot以多种优秀特性引领潮流,在众多使 ...
- SpringBoot + Shiro + shiro.ini 的踩坑记录
0.写在前面的话 好久没写博客了,诶,好多时候偷懒直接就抓网上的资料丢笔记里了,也就没有自己提炼,偷懒偷懒.然后最近参加了一个网络课程,要交作业的那种,为了能方便看下其他同学的作业,就写了个爬虫把作业 ...
随机推荐
- apache的下载
官网http://www.apache.org/ 首页第三行左右 点a number of third party vendors 再点第一个ApacheHaus 最后来到windows的下载页面 h ...
- logging basic
logging模块是Python内置的标准模块,主要用于输出运行日志,可以设置输出日志的等级.日志保存路径.日志文件回滚等. 相比print,具备如下优点: 可以通过设置不同的日志等级, ...
- Ubuntu18.04安装Vim-plug与YCM
由于个人强迫症的原因,之前的ycm是通过vundle来管理的,这次想更新一下ycm发现问题太多,于是就重新装了个Ubuntu虚拟机,用vim-plug来进行管理ycm及其他插件. 首先要换一下Ubun ...
- [HTTP]HTTP/1.1 协议Expect: 100-continue
在追踪请求时发现了这么一个http头 基础知识背景:1)“Expect: 100-continue”的来龙去脉: HTTP/1.1 协议里设计 100 (Continue) HTTP 状态码的的目的是 ...
- C++模板详解(三):参数化声明详解
在前两节中(C++模板详解(一).C++模板详解(二)),我们了解了函数模板和类模板的基本概念和使用方法.在这篇博文里,我们主要来详细地阐述一下"模板的参数声明"这个话题,并且也谈 ...
- linux下的apue.3e安装[Unix环境高级编程]
近期正在看<Unix环境高级编程>一书,目前看了20多页,书中 有几个c的例程,于是想着,也让它运行一下,看看是否跟描述相符,做开发人员本应该这样,于是敲了一部分代码,然后编译,发现并不能 ...
- hadoop学习笔记(一):NameNade持久化和DataNode概念
其中的fsimage 称为时点备份,又叫磁盘镜像快照,这个是NameNode的一个 持久化的方式之一:缺点,在内存数据序列化的时候比较慢 具体的过程:因为我们所知道的NameNode一般是存储在内存中 ...
- Linux下Nginx1.9.9的安装
1.环境安装 yum install gcc-c++ .yum -y install pcre*.yum -y install openssl* (安装顺序安装) 2.下载压缩包(这里我使用的是老本 ...
- JQ - 绑定(on)/解绑(off)事件(浅显的见解)
on 绑定事件: $("selector").on("click",事件执行函数名); //为 selector 添加 点击事件 $("selecto ...
- CSS3绘制不规则图形,代码收集
三角形系列(三角形.倒三角.左三角.右三角.左上三角.右上三角.左下三角.右下三角) 主要用到的是:宽度高度设置为0, border的各个边的设置(各个边的透明或不透明): .triangle-up ...