按照https://www.cnblogs.com/huanchupkblog/archive/2019/04/11/10687680.html 跑cat的demo
调用链cat部署报错:
[04-20 14:52:00.589] [INFO] [DefaultDataSourceProvider] Loading data sources from \data\appdatas\cat\datasources.xml ...
[04-20 14:52:00.590] [INFO] [DefaultDataSourceProvider] Loading data sources from \data\appdatas\cat\datasources.xml ...
[04-20 14:52:02.211] [ERROR] [HttpServlet] Error occured when handling uri: /cat/s/router
java.lang.RuntimeException: Error occured during handling outbound action(router)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleException(DefaultRequestLifecycle.java:89)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleRequest(DefaultRequestLifecycle.java:190)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handle(DefaultRequestLifecycle.java:63)
at org.unidal.web.MVC.service(MVC.java:90)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
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:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:439)
at com.dianping.cat.servlet.CatFilter$CatHandler$3.handle(CatFilter.java:236)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter$CatHandler$4.handle(CatFilter.java:329)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter$CatHandler$2.handle(CatFilter.java:219)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter$CatHandler$1.handle(CatFilter.java:127)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter.doFilter(CatFilter.java:65)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.dianping.cat.system.page.permission.PermissionFilter.doFilter(PermissionFilter.java:94)
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:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
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)
Caused by: org.unidal.web.mvc.ActionException: Error occured during handling outbound action(router)
at org.unidal.web.mvc.lifecycle.DefaultOutboundActionHandler.handle(DefaultOutboundActionHandler.java:36)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleOutboundAction(DefaultRequestLifecycle.java:111)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleRequest(DefaultRequestLifecycle.java:188)
... 40 more
Caused by: java.lang.RuntimeException: Error occured during invoking method: public void com.dianping.cat.system.page.router.Handler.handleOutbound(com.dianping.cat.system.page.router.Context) throws javax.servlet.ServletException,java.io.IOException with parameters([com.dianping.cat.system.page.router.Context@6cfb0a00])
at org.unidal.lookup.util.ReflectUtils.invokeMethod(ReflectUtils.java:51)
at org.unidal.web.mvc.lifecycle.DefaultOutboundActionHandler.handle(DefaultOutboundActionHandler.java:29)
... 42 more
Caused by: java.lang.ArithmeticException: / by zero
at com.dianping.cat.system.page.router.config.RouterConfigManager.queryServersByDomain(RouterConfigManager.java:286)
at com.dianping.cat.system.page.router.Handler.buildRouterInfo(Handler.java:88)
at com.dianping.cat.system.page.router.Handler.buildKvs(Handler.java:180)
at com.dianping.cat.system.page.router.Handler.handleOutbound(Handler.java:143)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.unidal.lookup.util.ReflectUtils.invokeMethod(ReflectUtils.java:49)
... 43 more
[04-20 14:52:02.212] [WARN] [DefaultClientConfigManager] error when connect cat server config url http://127.0.0.1:8080/cat/s/router?domain=cat&ip=192.168.6.108&op=json
[04-20 14:52:12.259] [ERROR] [HttpServlet] Error occured when handling uri: /cat/s/router
java.lang.RuntimeException: Error occured during handling outbound action(router)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleException(DefaultRequestLifecycle.java:89)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleRequest(DefaultRequestLifecycle.java:190)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handle(DefaultRequestLifecycle.java:63)
at org.unidal.web.MVC.service(MVC.java:90)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
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:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:439)
at com.dianping.cat.servlet.CatFilter$CatHandler$3.handle(CatFilter.java:236)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter$CatHandler$4.handle(CatFilter.java:329)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter$CatHandler$2.handle(CatFilter.java:219)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter$CatHandler$1.handle(CatFilter.java:127)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter.doFilter(CatFilter.java:65)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.dianping.cat.system.page.permission.PermissionFilter.doFilter(PermissionFilter.java:94)
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:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
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)
Caused by: org.unidal.web.mvc.ActionException: Error occured during handling outbound action(router)
at org.unidal.web.mvc.lifecycle.DefaultOutboundActionHandler.handle(DefaultOutboundActionHandler.java:36)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleOutboundAction(DefaultRequestLifecycle.java:111)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleRequest(DefaultRequestLifecycle.java:188)
... 40 more
Caused by: java.lang.RuntimeException: Error occured during invoking method: public void com.dianping.cat.system.page.router.Handler.handleOutbound(com.dianping.cat.system.page.router.Context) throws javax.servlet.ServletException,java.io.IOException with parameters([com.dianping.cat.system.page.router.Context@4d66267f])
at org.unidal.lookup.util.ReflectUtils.invokeMethod(ReflectUtils.java:51)
at org.unidal.web.mvc.lifecycle.DefaultOutboundActionHandler.handle(DefaultOutboundActionHandler.java:29)
... 42 more
Caused by: java.lang.ArithmeticException: / by zero
at com.dianping.cat.system.page.router.config.RouterConfigManager.queryServersByDomain(RouterConfigManager.java:286)
at com.dianping.cat.system.page.router.Handler.buildRouterInfo(Handler.java:88)
at com.dianping.cat.system.page.router.Handler.buildKvs(Handler.java:180)
at com.dianping.cat.system.page.router.Handler.handleOutbound(Handler.java:143)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.unidal.lookup.util.ReflectUtils.invokeMethod(ReflectUtils.java:49)
... 43 more
[04-20 14:52:12.262] [WARN] [DefaultClientConfigManager] error when connect cat server config url http://127.0.0.1:8080/cat/s/router?domain=cat&ip=192.168.6.108&op=json
[04-20 14:52:22.299] [ERROR] [HttpServlet] Error occured when handling uri: /cat/s/router
java.lang.RuntimeException: Error occured during handling outbound action(router)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleException(DefaultRequestLifecycle.java:89)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleRequest(DefaultRequestLifecycle.java:190)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handle(DefaultRequestLifecycle.java:63)
at org.unidal.web.MVC.service(MVC.java:90)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
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:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:439)
at com.dianping.cat.servlet.CatFilter$CatHandler$3.handle(CatFilter.java:236)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter$CatHandler$4.handle(CatFilter.java:329)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter$CatHandler$2.handle(CatFilter.java:219)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter$CatHandler$1.handle(CatFilter.java:127)
at com.dianping.cat.servlet.CatFilter$Context.handle(CatFilter.java:437)
at com.dianping.cat.servlet.CatFilter.doFilter(CatFilter.java:65)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.dianping.cat.system.page.permission.PermissionFilter.doFilter(PermissionFilter.java:94)
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:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
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)
Caused by: org.unidal.web.mvc.ActionException: Error occured during handling outbound action(router)
at org.unidal.web.mvc.lifecycle.DefaultOutboundActionHandler.handle(DefaultOutboundActionHandler.java:36)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleOutboundAction(DefaultRequestLifecycle.java:111)
at org.unidal.web.mvc.lifecycle.DefaultRequestLifecycle.handleRequest(DefaultRequestLifecycle.java:188)
... 40 more
Caused by: java.lang.RuntimeException: Error occured during invoking method: public void com.dianping.cat.system.page.router.Handler.handleOutbound(com.dianping.cat.system.page.router.Context) throws javax.servlet.ServletException,java.io.IOException with parameters([com.dianping.cat.system.page.router.Context@7308cb7b])
datasources.xml配置文件的问题:
3
100s
100s
1000
com.mysql.jdbc.Driver
jdbc:mysql://192.168.190.130:49306/test
root
MySQL-89029918
useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&socketTimeout=120000
这里面url和connectionProperties节点没有加入这个标记标记的内容将被表示为纯文本,
在解析xml文件的时候会有些特殊符号将会被转义,但我们不希望他被转义,或者xml节点包含< 或者& 这些在xml解析的过程中是不被允许的,所以我们要使用来解决,将他们统一标记为纯文本。
正确的datasources.xml格式文件为:
3
100s
100s
1000
com.mysql.jdbc.Driver
root
MySQL-89029918
修改完成之后,重启tomcat 问题解决。