记录:redis-server.exe双击闪退的问题
1、进入redis-server.exe
所在的文件夹,进入cmd命令框
2、输入 redis-server.exe redis.windows.conf
,出现如下错误
3、按顺序输入如下命令即可连接成功
redis-cli.exe
shutdown
exit
redis-server.exe redis.windows.conf
在参考别的文章中提到,如果在输入
redis-server.exe redis.windows.conf
报出图示错误时,需要打开redis文件夹中的redis.windows.conf
找到56行的 #bind 127.0.0.1 去掉#。但是我的文件中并没有#也出现了这样的错误,忽略这一步,直接照顺序执行命令即可PS:经多次启动发现,该方法不能保证以后不会出现闪退,出现闪退,重发操作即可。
论坛服务器中可以成功调用接口,但是启动FeignClient服务器调用当前服务器无法成功调用
报错如下:
Optional int parameter 'id' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.
解决:添加注解@RequestParam("")
@RequestParam是将请求参数和控制器方法的形参创建映射关系
@RequestParam注解一共三个属性:
value:指定为形参赋值的请求参数的参数名
required:设置是否必须传输此请求参数,默认为true
defaultValue:不管required属性值为true或false,当value所指定的请求参数没有传输或传输的值
为""时,则使用默认值为形参赋值
插入语句传入对象参数,论坛服务器无法获取到参数,需要在方法添加@RequestBody
HttpMessageConverter报文信息转换器:将请求报文转换为Java对象,或将Java对象转换为响应报文
@RequestBody:可以获取请求体,需要在控制器方法设置一个形参,使用@RequestBody进行标识,当前请求的请求体就会为当前注解所标识的形参赋值
@ResponseBody:用于标识一个控制器方法,可以将该方法的返回值直接作为响应报文的响应体响应到浏览器
@RequestMapping("/testResponseBody") @ResponseBody public String testResponseBody(){ return "success"; } //结果:浏览器页面显示success
@RestController是springMVC提供的一个复合注解,标识在控制器的类上,相当于为类添加了@Controller注解,并且其中的每个方法添加了@ResponseBody注解
项目中导入导入hadoop项目依赖后出现以来冲突的问题
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1355)
The following method did not exist:
javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
The method's class, javax.servlet.ServletContext, is available from the following locations:
jar:file:/你自己的.m2镜像所在位置/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar!/javax/servlet/ServletContext.class
jar:file:/你自己的.m2镜像所在位置/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.41/tomcat-embed-core-9.0.41.jar!/javax/servlet/ServletContext.class
The class hierarchy was loaded from the following locations:
javax.servlet.ServletContext: file:/你自己的.m2镜像所在位置/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.ServletContext
最后一句翻译为:更正应用程序的类路径,使其包含单个兼容版本的javax.servlet.ServletContext
意思就是你的servlet依赖冲突了
解决步骤:
打开pom.xml
切换到Dependency Analyzer
模式下
搜索servlet-api
排出依赖:右击选择的依赖,选择Exclude
切换到Text
,依赖冲突排除
参考博文地址:https://www.cnblogs.com/langkyeSir/p/15301926.html