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.写在前面的话 好久没写博客了,诶,好多时候偷懒直接就抓网上的资料丢笔记里了,也就没有自己提炼,偷懒偷懒.然后最近参加了一个网络课程,要交作业的那种,为了能方便看下其他同学的作业,就写了个爬虫把作业 ...
随机推荐
- jmeter的BeanShell Sampler使用--导入第三方jar包
实现目的 测试接口的过程中,可能有时需要用到第三方jar包来生成一些测试数据,此时我们就可以通过BeanShell来调用自己编写的工具类,来对jmeter的功能进行扩展,以满足测试需要. 脚本实现 在 ...
- TCL Strings
append Append values to variable binary Insert and extract fields from binary strings regexp ...
- 批处理设置IP
@echo off title 静态IP设置 set netName=本地连接 set address=192.168.1.202 netsh netsh interface ipv4 set dns ...
- 控制反转(IOC)和依赖注入(DI)
控制反转(IOC)和依赖注入(DI)IoC(Inversion of Control,控制反转) 是Spring 中一个非常非常重要的概念,它不是什么技术,而是一种解耦的设计思想.它的主要目的是借助于 ...
- HDFS的常用命令
一.常用命令 二.其他命令
- ParameterizedType 使用方法
ParameterizedType 它是jdk提供的参数化类型,包括了如下 请求参数,和响应参数都是 参数话类型.记住凡是含有<T>中的都是参数话类型. public static < ...
- flink整合kafka报错 WARN - Bootstrap broker ip:9092 disconnected
WARN - The configuration 'zookeeper.connect' was supplied but isn't a known config.WARN - The config ...
- Centos5.5+LAMP环境
Note:如果网络正常,apache服务正常,仍然不能访问网页.需要检查linux 防火墙是否关闭. ( 先重新启动防火墙 service iptables start 然后输入配置防火墙的命令并查看 ...
- Spring Boot 学习方法论-如何正确的入门 Spring Boot
想要入门 Spring Boot,那么什么样的教程是符合初学者学习的(没有太多的Java基础但有一些程序基础或者软件编程知识). 这恰好能够勾出很多问题,比如是文章图文教程适合还是视频教程适合零基础初 ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy 数据类型
下表列举了常用 NumPy 基本类型. 名称 描述 bool_ 布尔型数据类型(True 或者 False) int_ 默认的整数类型(类似于 C 语言中的 long,int32 或 int64) i ...