开发中遇到的错误
李喵喵同学
这个作者很懒,什么都没留下…
展开
-
解决CLion不能同时存在多个main函数的问题
修改 CMakeLists.txtcmake_minimum_required(VERSION 3.20)project(C C)set(CMAKE_C_STANDARD 99)# 遍历项目根目录下所有的 .c 文件# 如果你只需要根目录下的 test 文件夹的所有 .c 文件file (GLOB files test/*.c)# 如果你只有两层目录的话file (GLOB files *.cpp */*.c)# 同理,三层的话file (GLOB files *.c */*.c *转载 2021-08-29 20:12:47 · 737 阅读 · 0 评论 -
SpringCloud Feign报错:Method has too many Body parameters
报错:Caused by: java.lang.IllegalStateException: Method has too many Body parameters:解决:调用方添加@RequestParam注解提供服务方使用@Param注解参考文章:SpringCloud Feign报错:Method has too many Body parameters转载 2020-06-09 13:05:06 · 620 阅读 · 0 评论 -
远程调用上传文件服务时报错:multipart/form-data not set for request body of type StandardMultipartFile
问题描述:现有两个微服务应用,服务A和服务B,,服务A用于接收前端文件上传请求,服务B用于实现文件的上传,当使用前端调用服务A调用远程服务B时出现如下错误:报错:feign.codec.EncodeException: Content-Type “multipart/form-data” not set for request body of type StandardMultipartFile解决:在需要调用远程文件服务的服务A的接口@PostMapping注解中添加consumes = “mult原创 2020-06-08 17:02:46 · 5202 阅读 · 2 评论 -
使用Feign服务远程调用项目启动时报错:Field xxx in xxx required a bean of type xxx that could not be found.
报错:***************************APPLICATION FAILED TO START***************************Description:Field xxx in xxx required a bean of type 'xxx' that could not be found.The injection point has the following annotations: - @org.springframework.beans原创 2020-06-05 15:58:57 · 1501 阅读 · 0 评论 -
使用@RequestBody注解报错:Required request body is missing
问题描述:在方法参数中使用@RequestBody注解时,传递参数时,出现错误报错:org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing:原因:使用@RequestBody注解时,方法接收请求必须使用@GetMapping方式解决:将方法修改为@GetMapping请求方式...原创 2020-06-03 15:51:01 · 2360 阅读 · 0 评论 -
Feign服务调用时报错feign.RetryableException: Read timed out executing ...
报错:feign.RetryableException: Read timed out executing …原因:Feign客户端调用服务端的时候连接超时解决:在配置文件中配置超时时间# 防止连接超时feign.client.config.default.connect-timeout=20000feign.client.config.default.read-timeout=20000...原创 2020-06-01 14:24:17 · 1688 阅读 · 0 评论 -
MultipartFile上传文件报错:java.lang.NullPointerException
问题描述:使用Swagger测试上传文件成功,但是从前端上传文件时,后端出现了空指针的错误。报错:java.lang.NullPointerException原因:后端接收使用的参数名与前端传过来的name属性不一致解决:修改后端方法参数名与name属性的值一样...原创 2020-06-01 08:36:50 · 1896 阅读 · 0 评论 -
ES6模块化,使用node.js运行时报错 SyntaxError: Cannot use import statement outside a module
问题描述:ES6模块化,使用node.js运行时报错:SyntaxError: Cannot use import statement outside a module原因:ES6的模块化代码无法在Node.js中执行解决:使用Babel转码成ES5后再执行Babel的使用方法:# 转码结果写入一个文件mkdir dist1# --out-file 或 -o 参数指定输出文件babel src/example.js --out-file dist1/compiled.js# 或者原创 2020-05-24 21:53:06 · 5326 阅读 · 0 评论 -
Babel转码时报错 Unexpected EOF at line 1 column 2 of the JSON5 data. Still to read:“”
问题描述:使用Babel转码时报错:Error while parsing JSON - Unexpected EOF at line 1 column 2 of the JSON5 data. Still to read: “”原因:编辑.babelrc文件完成后没有保存,导致读到的是空。解决:保存.babelrc文件再次测试,执行成功...原创 2020-05-24 20:27:53 · 1659 阅读 · 5 评论