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.写在前面的话 好久没写博客了,诶,好多时候偷懒直接就抓网上的资料丢笔记里了,也就没有自己提炼,偷懒偷懒.然后最近参加了一个网络课程,要交作业的那种,为了能方便看下其他同学的作业,就写了个爬虫把作业 ...
随机推荐
- python中字符串的四种表达方式
今天在学习python的基础的内容,学习在python中如何操作字符串,在此记录下. 主要是python中字符串的几种表达,表示方式. python的几种表达方式 1 使用单引号扩起来字符串 > ...
- 种树-洛谷P1250(差分约束)
传送门 令前缀和为s[i],则⼀一个要求等价于 s[r] - s[l - 1] >= x. 题中还有别的要求,包括 s[i] - s[i - 1] <= 1 和 s[i] - s[i- 1 ...
- Cosmetic Airless Bottles To Meet Practical Requirements
Today, people use cosmetic bottles, many of which are in cosmetic airless bottles. We can use them, ...
- opencv:图像直方图均衡化
// 直方图均衡化 Mat gray, dst; cvtColor(src, gray, COLOR_BGR2GRAY); equalizeHist(gray, dst); imshow(" ...
- finally语句块一定会被执行吗
finally语句块一定会被执行吗? 答案: 不一定 1. 发生异常的代码必须在try 代码块中,才有可能被执行 public class MyTest { public static void ma ...
- iOS 实现 摇一摇
摇一摇功能:调用了系统自带加速器,当设备摇动时,系统会 计算出加速器的加速值,然后告诉设备是否发生摇动手势,系统只会运动开始和结束时通知你,并不会在运动发生的整个过程中始终向你报告每一次运动.例如,你 ...
- STUN和TURN协议解析
在现实Internet网络环境中,大多数计算机主机都位于防火墙或NAT之后,只有少部分主机能够直接接入Internet.很多时候,我们希望网络中的两台主机能够直接进行通信,即所谓的P2P通信,而不需要 ...
- 04-Docker-Container管理操作
目录 04-Docker-Container管理操作 参考 容器运行须知 容器生命周期 容器管理命令 1. 生命周期 2. 查看操作 3. 命令执行 4. 文件复制 容器用途分类 04-Docker- ...
- 刷题15. 3Sum
一.题目说明 题目非常简洁15. 3Sum,读懂题目后,理解不难. 但 实话说,我们提交代码后,Time Limit Exceeded,最主要的是给了非常长的测试用例,我本地运行后87秒,确实时间非常 ...
- DataFrame loc和iloc的区别
loc loc是select by label(name) loc函数是选择dataframe中那一行的index == k的 iloc loc是select by position loc函数是选择 ...