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.写在前面的话 好久没写博客了,诶,好多时候偷懒直接就抓网上的资料丢笔记里了,也就没有自己提炼,偷懒偷懒.然后最近参加了一个网络课程,要交作业的那种,为了能方便看下其他同学的作业,就写了个爬虫把作业 ...
随机推荐
- Java经典面试笔试题及答案
1.什么是对象序列化,为什么要使用? 所谓对象序列化就是把一个对象以二进制流的方式保存到硬盘上.好处:方便远程调用. 2.值传递与引用传递的区别? 所谓值传递就是把一个对象的值传给一个新的变量,但是系 ...
- 每日扫盲(一):java的rmi
JAVA RMI 原理和使用浅析 本地对象调用 我们先看看本地对象方法的调用: ObjectClass objectA = new ObjectClass(); String retn = objec ...
- Innovus update_io_latency
在Innovus中从ccopt 后的timing report中可以看到clock delay是从负值开始算起的,这个是因为在ccopt过程中进行了的update latency的动作. 基于bloc ...
- linux 网络数据收发网络流量监控
网卡流量 1.iftop命令 iftop可以用来监控网卡的实时流量(可以指定网段).反向解析IP.显示端口信息.TCP/IP连接等官网:http://www.ex-parrot.com/~pdw/if ...
- python基础之函数,递归,内置函数
一.数学定义的函数与python中的函数 初中数学函数定义:一般的,在一个变化过程中,如果有两个变量x和y,并且对于x的每一个确定的值,y都有唯一确定的值与其对应,那么我们就把x称为自变量,把y称为因 ...
- vue 路由传参 以及获取参数
1.通过query实现: <router-link :to="{ name:'home',query:{id:1} }">跳转页面</router-link> ...
- vs2019 opencv4的相关配置
opencv4.11存在改动,导致许多demo没有办法正常运行,但是配置方法却是相同的. 主要是连接器输入,头文件包含路径,库路.如果想要调试,还需要设置调试文件符号表. [未完待续]
- 【MySQL】外键的变种
" 目录 三种关系 多对一 多对多 一对一 因为有foreign key的约束,使得两张表形成了三种关系: 多对一 多对多 一对多 重点理解如何找出两张表之间的关系 现在有A.B两张表 分析 ...
- 好用的px转rem插件cssrem
下载本项目,比如:git clone https://github.com/flashlizi/cssrem 进入packages目录:Sublime Text -> Preferences - ...
- CSS实现心形、六角星、六边形、平行四边形等几何
本文将利用border属性实现简单几何的绘制: 效果图: 正八角星 说明:采用两个正方形以中心进行旋转叠加: /* 八角星 */ #burst-8 { background: #6376ff1f; w ...