您好,登錄后才能下訂單哦!
這篇文章給大家介紹disconf中有哪些服務器內部錯誤,內容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。
原因如下:
發(fā)版之前進行修改
disconf
配置中心的配置數據,結果發(fā)現disconf
的XX項目配置中心管理界面的配置文件頁面為空。當時就嚇壞了,以為是服務掛了,如果配置中心整個服務掛了就很嚴重了,馬上看了下別的項目的配置中心頁面是正常的, 唯獨XX項目的是空白,趕緊看了下XX項目的應用日志,一切正常,由此馬上F12查看disconf
后臺的請求,發(fā)現返回了一段json錯誤信息,服務器內部錯誤。
進入生產環(huán)境查看 disconf
的報錯日志,發(fā)現報錯表現很模糊:
xx:xx:50.591 [http-bio-xxxxx-xxxx-exec-xx] WARN c.b.d.c.handler.MyExceptionHandler - /xxx/xx/xxx/list ExceptionHandler FOUND. com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 128 java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 128 xx:xx:50.592 [http-bio-xxxxx-xxxx-exec-xx] WARN c.b.d.c.handler.MyExceptionHandler - details: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 128 at com.google.gson.Gson.fromJson(Gson.java:815) ~[gson-2.2.4.jar:na] at com.google.gson.Gson.fromJson(Gson.java:768) ~[gson-2.2.4.jar:na] at com.google.gson.Gson.fromJson(Gson.java:717) ~[gson-2.2.4.jar:na] at com.github.knightliao.apollo.utils.data.GsonUtils.parse2Map(GsonUtils.java:44) ~[apollo-1.0.12.jar:na] at com.baidu.disconf.web.service.config.service.impl.ConfigMgrImpl.compareConfig(ConfigMgrImpl.java:306) ~[classes/:na] at com.baidu.disconf.web.service.config.service.impl.ConfigMgrImpl.getZkData(ConfigMgrImpl.java:215) ~[classes/:na] at com.baidu.disconf.web.service.config.service.impl.ConfigMgrImpl.convert(ConfigMgrImpl.java:280) ~[classes/:na] at com.baidu.disconf.web.service.config.service.impl.ConfigMgrImpl.access$000(ConfigMgrImpl.java:58) ~[classes/:na] at com.baidu.disconf.web.service.config.service.impl.ConfigMgrImpl$1.transfer(ConfigMgrImpl.java:188) ~[classes/:na] at com.baidu.disconf.web.service.config.service.impl.ConfigMgrImpl$1.transfer(ConfigMgrImpl.java:176) ~[classes/:na] at com.baidu.dsp.common.utils.ServiceUtil.getResult(ServiceUtil.java:35) ~[classes/:na] at com.baidu.disconf.web.service.config.service.impl.ConfigMgrImpl.getConfigList(ConfigMgrImpl.java:175) ~[classes/:na] at com.baidu.disconf.web.service.config.service.impl.ConfigMgrImpl$$FastClassBySpringCGLIB$$7099537e.invoke(<generated>) ~[spring-core-4.1.7.RELEASE.jar:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:649) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at com.baidu.disconf.web.service.config.service.impl.ConfigMgrImpl$$EnhancerBySpringCGLIB$$1f1102ef.getConfigList(<generated>) ~[spring-core-4.1.7.RELEASE.jar:na] at com.baidu.disconf.web.web.config.controller.ConfigReadController.getConfigList(ConfigReadController.java:90) ~[classes/:na] at com.baidu.disconf.web.web.config.controller.ConfigReadController$$FastClassBySpringCGLIB$$bed0282a.invoke(<generated>) ~[spring-core-4.1.7.RELEASE.jar:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at com.baidu.disconf.web.service.roleres.service.RoleResourceAspect.decideAccess(RoleResourceAspect.java:109) ~[classes/:na] at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE] at com.baidu.disconf.web.web.config.controller.ConfigReadController$$EnhancerBySpringCGLIB$$5d4c3283.getConfigList(<generated>) ~[spring-core-4.1.7.RELEASE.jar:na] at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) ~[spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) ~[spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) [servlet-api.jar:na] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) [spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) [servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [catalina.jar:7.0.68] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat7-websocket.jar:7.0.68] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.68] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.68] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.68] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [catalina.jar:7.0.68] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.68] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) [catalina.jar:7.0.68] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) [catalina.jar:7.0.68] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.68] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) [catalina.jar:7.0.68] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.68] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) [catalina.jar:7.0.68] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) [tomcat-coyote.jar:7.0.68] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) [tomcat-coyote.jar:7.0.68] at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) [tomcat-coyote.jar:7.0.68] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_25] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_25] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.68] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25] Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 128 at com.google.gson.stream.JsonReader.nextString(JsonReader.java:821) ~[gson-2.2.4.jar:na] at com.google.gson.internal.bind.TypeAdapters$13.read(TypeAdapters.java:358) ~[gson-2.2.4.jar:na] at com.google.gson.internal.bind.TypeAdapters$13.read(TypeAdapters.java:346) ~[gson-2.2.4.jar:na] at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) ~[gson-2.2.4.jar:na] at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:187) ~[gson-2.2.4.jar:na] at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145) ~[gson-2.2.4.jar:na] at com.google.gson.Gson.fromJson(Gson.java:803) ~[gson-2.2.4.jar:na] ... 77 common frames omitted xx:xx:50.592 [http-bio-xxxxx-xxxx-exec-xx] INFO c.b.dsp.common.vo.JsonObjectUtils - JsonObjectBase [message={global=服務器內部錯誤}, sessionId=xxxxx-axx4-xx-xxx-fbxxxcx1xxa7, success=false]
由此猜測是新增了配置文件,但是配置文件可能配型或者值不對或者出現了特殊字符,導致了解析失敗了。
查了下應用的配置中心的代碼,發(fā)現的確有新的配置文件且從生產數據庫和 zookeeper
撈出來的數據來看配置本身含有特殊字符,猜測是中文注釋,看了下我們自己的應用代碼,發(fā)現開發(fā)人員使用了很奇怪的 Map
類型做 key
。
馬上靈機一動在測試環(huán)境復現下這個問題,結果發(fā)現果然有辦法復現,觸發(fā)條件也和預想的一樣。
觸發(fā)條件: 使用 Map
類型,且首行使用中文注釋,且定義的 Map
類型在 disconf
不設置值。
配置好了之后,刷新 disconf
配置頁面,發(fā)現頁面報錯 , 請求 disconf
返回json結果 服務器內部錯誤
。
換一個配置文件名稱,去掉 Map
類型使用基本的 String
放置 json
數據, 自己通過代碼轉換 json
為對象,刪除原配置文件,disconf
恢復正常。
根本原因沒有去找,實在是沒有時間去看 disconf
的源碼。。。
disconf
版本: 2.6.30
關于disconf中有哪些服務器內部錯誤就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。