Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw NoSuchFieldException in ConfigController when service connect to nacos #5182

Closed
q975144677 opened this issue Mar 24, 2021 · 5 comments · Fixed by #5201
Closed

throw NoSuchFieldException in ConfigController when service connect to nacos #5182

q975144677 opened this issue Mar 24, 2021 · 5 comments · Fixed by #5201
Assignees
Labels
area/Config kind/bug Category issues or prs related to bug.

Comments

@q975144677
Copy link

Type: bug report

Describe what happened (or what feature you want)

Throw NoSuchFieldException in ConfigController when service connect to Nacos.
Nacos Service will shutdown after I close all application and wait for a while . Although there is no service alive.
But services go right if Nacos is alive.

启动服务然后连接Nacos的时候抛出NoSuchFieldException 异常。关闭服务后,尽管没有服务连着,Nacos运行一段时间后也会挂掉。
虽然有异常,但是只要Nacos不挂还是能够正常使用的。
英文不大好,还请谅解。

Describe what you expected to happen

Keep Nacos running without this exception 。

How to reproduce it (as minimally and precisely as possible)

  1. sh startup.sh -m standalone
  2. start springboot application and connect Nacos

Tell us your environment

Nacos 2.0.0 且配置文件无改动,数据库原生的内嵌数据库未改动
spring-cloud-starter-alibaba-nacos-discovery / config 2.2.3.RELEASE
nacos client 1.3.2
CentOS 6.7

Anything else we need to know?

报错日志

2021-03-24 21:00:57,364 WARN remove listen request param error

java.lang.NoSuchFieldException: request
        at java.lang.Class.getDeclaredField(Class.java:2070)
        at com.alibaba.nacos.config.server.controller.ConfigController.removeRequestContext(ConfigController.java:314)
        at com.alibaba.nacos.config.server.controller.ConfigController.listener(ConfigController.java:353)
        at com.alibaba.nacos.config.server.controller.ConfigController$$FastClassBySpringCGLIB$$dbb89c38.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:752)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691)
        at com.alibaba.nacos.config.server.controller.ConfigController$$EnhancerBySpringCGLIB$$36126c39.listener(<generated>)
        at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:97)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at com.alibaba.nacos.core.auth.AuthFilter.doFilter(AuthFilter.java:69)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at com.alibaba.nacos.config.server.filter.NacosWebFilter.doFilter(NacosWebFilter.java:67)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:209)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:94)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114)
        at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
@Maijh97
Copy link
Collaborator

Maijh97 commented Mar 24, 2021

我这边复现不了该问题,请问你客户端那边还有做了其它操作吗?

@gxqgithub
Copy link

gxqgithub commented Mar 25, 2021

我的也报这个错误,启动命令如下
docker run -d
-e MODE=standalone
-e PREFER_HOST_MODE=ip
--restart=always
-e MYSQL_SERVICE_HOST=114.116.xxx.xxx
-e MYSQL_SERVICE_PORT=3306
-e MYSQL_SERVICE_USER=用户名
-e MYSQL_SERVICE_PASSWORD=密码
-e MYSQL_SERVICE_DB_NAME=nacos_config
-e SPRING_DATASOURCE_PLATFORM=mysql
-e JVM_XMS=1024m -e JVM_XMX=1024m -e JVM_XMN=512m
-v /my/nacos/logs:/home/nacos/logs
-v /my/nacos/conf:/home/nacos/conf
-v /my/nacos/plugins:/home/nacos/plugins
-v /my/nacos/init.d:/home/nacos/init.d
-p 8848:8848
--name nacos
nacos/nacos-server:2.0.0

@q975144677
Copy link
Author

没有其他操作,为了避免我这边操作的问题,我还重新下了个nacos,结果依然报这个错。
我这边再换别的机器试试。

Maijh97 added a commit to Maijh97/nacos that referenced this issue Mar 26, 2021
…n approach and decided to remove RemoveRequest Context
Maijh97 added a commit to Maijh97/nacos that referenced this issue Mar 26, 2021
…n approach and decided to remove RemoveRequest Context
@Maijh97 Maijh97 added area/Config kind/bug Category issues or prs related to bug. and removed kind/research status/need feedback labels Mar 26, 2021
Maijh97 added a commit that referenced this issue Mar 26, 2021
…5201)

* fix #5182, After some discussion, 2.0 adopted a long connection approach and decided to remove RemoveRequest Context

* fix #5182, After some discussion, 2.0 adopted a long connection approach and decided to remove RemoveRequest Context

* Removing invalid import
@Maijh97 Maijh97 linked a pull request Mar 26, 2021 that will close this issue
5 tasks
@Maijh97
Copy link
Collaborator

Maijh97 commented Mar 26, 2021

fix pr #5201

@Maijh97 Maijh97 closed this as completed Mar 26, 2021
@dwwangzz
Copy link

dwwangzz commented Mar 26, 2021

  1. 你可以试试调用以下API:http://ip:port/nacos/v1/ns/instance , 看看是不是报错server is DOWN now, please try again later!
  2. 官方文档给出了解决方案,见FAQ第二条,https://nacos.io/zh-cn/docs/2.0.0-compatibility.html
    引用官方文档:
    启动后,调用openAPI 报错 code:503,msg:server is DOWN now, please try again later!
    Nacos在1.4版本后使用Jraft替换了自研的Raft实现,Jraft的选主比原先自研的Raft更加严格,会记录之前启动时的ip或host。因此重启时如果ip变动了,有可能造成选主失败,从而导致nacos无法正确提供服务。 解决方式为删除nacos目录下的data,再启动。
    或者使用-Dnacos.server.ip=${domain},然后将nacos/conf的cluster.conf配置domain列表,避免重启时ip变动导致的raft选主问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Config kind/bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants