开发者社区> 问答> 正文

mse网关不是只能对接spring cloud微服务,你如果静态资源放在nginx里,在K8s里创建

日志:

java.lang.reflect.UndeclaredThrowableException: null at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:769) ~[na:na] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703) ~[na:na] at com.zaxxer.hikari.HikariDataSource$$SpringCGLIB$$0.getConnection() ~[test-compatibility-springboot3-seata.exe:na] at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:159) ~[na:na] at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:117) ~[na:na] at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80) ~[na:na] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:376) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:431) ~[test-compatibility-springboot3-seata.exe:6.0.3] at cn.wangliang181230.seata.TestService.test(TestService.java:45) ~[test-compatibility-springboot3-seata.exe:na] at java.base@17.0.5/java.lang.reflect.Method.invoke(Method.java:568) ~[test-compatibility-springboot3-seata.exe:na] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[na:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:752) ~[na:na] at io.seata.spring.annotation.GlobalTransactionalInterceptor$2.execute(GlobalTransactionalInterceptor.java:204) ~[na:na] at io.seata.tm.api.TransactionalTemplate.execute(TransactionalTemplate.java:130) ~[na:na] at io.seata.spring.annotation.GlobalTransactionalInterceptor.handleGlobalTransaction(GlobalTransactionalInterceptor.java:201) ~[na:na] at io.seata.spring.annotation.GlobalTransactionalInterceptor.invoke(GlobalTransactionalInterceptor.java:171) ~[na:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:752) ~[na:na] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703) ~[na:na] at cn.wangliang181230.seata.TestService$$SpringCGLIB$$0.test() ~[test-compatibility-springboot3-seata.exe:na] at cn.wangliang181230.seata.TestController.test(TestController.java:22) ~[test-compatibility-springboot3-seata.exe:na] at java.base@17.0.5/java.lang.reflect.Method.invoke(Method.java:568) ~[test-compatibility-springboot3-seata.exe:na] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:207) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:152) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:884) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1080) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:973) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1010) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:902) ~[test-compatibility-springboot3-seata.exe:6.0.3] at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:705) ~[test-compatibility-springboot3-seata.exe:6.0] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:884) ~[test-compatibility-springboot3-seata.exe:6.0.3] at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:814) ~[test-compatibility-springboot3-seata.exe:6.0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223) ~[na:na] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[na:na] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[test-compatibility-springboot3-seata.exe:10.1.4] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[na:na] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[na:na] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[na:na] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[na:na] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[na:na] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[na:na] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[na:na] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[na:na] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177) ~[na:na] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[na:na] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[test-compatibility-springboot3-seata.exe:10.1.4] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119) ~[na:na] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[test-compatibility-springboot3-seata.exe:10.1.4] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[na:na] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[na:na] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400) ~[na:na] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[test-compatibility-springboot3-seata.exe:10.1.4] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859) ~[na:na] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734) ~[na:na] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[test-compatibility-springboot3-seata.exe:10.1.4] at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[na:na] at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[na:na] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[na:na] at java.base@17.0.5/java.lang.Thread.run(Thread.java:833) ~[test-compatibility-springboot3-seata.exe:na] at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775) ~[test-compatibility-springboot3-seata.exe:na] at org.graalvm.nativeimage.builder/com.oracle.svm.core.windows.WindowsPlatformThreads.osThreadStartRoutine(WindowsPlatformThreads.java:178) ~[na:na] Caused by: java.lang.reflect.InvocationTargetException: null at java.base@17.0.5/java.lang.reflect.Method.invoke(Method.java:568) ~[test-compatibility-springboot3-seata.exe:na] at io.seata.spring.annotation.datasource.SeataAutoDataSourceProxyAdvice.invoke(SeataAutoDataSourceProxyAdvice.java:68) ~[na:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[test-compatibility-springboot3-seata.exe:6.0.3] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:752) ~[na:na] ... 71 common frames omitted Caused by: java.lang.ExceptionInInitializerError: null at io.seata.rm.datasource.util.XAUtils.createXAConnection(XAUtils.java:48) ~[na:na] at io.seata.rm.datasource.util.XAUtils.createXAConnection(XAUtils.java:43) ~[na:na] at io.seata.rm.datasource.xa.DataSourceProxyXA.getConnectionProxyXA(DataSourceProxyXA.java:112) ~[na:na] at io.seata.rm.datasource.xa.DataSourceProxyXA.getConnectionProxy(DataSourceProxyXA.java:101) ~[na:na] at io.seata.rm.datasource.xa.DataSourceProxyXA.getConnection(DataSourceProxyXA.java:88) ~[na:na] ... 75 common frames omitted Caused by: java.nio.charset.UnsupportedCharsetException: BIG5 at java.base@17.0.5/java.nio.charset.Charset.forName(Charset.java:528) ~[test-compatibility-springboot3-seata.exe:na] at com.alibaba.druid.util.MySqlUtils.(MySqlUtils.java:519) ~[na:na] ... 80 common frames omitted

截图:

T5.png

原提问者GitHub用户wangliang181230

展开
收起
山海行 2023-07-05 17:50:14 93 0
3 条回答
写回答
取消 提交回答
  • 北京阿里云ACE会长

    MSE 网关不仅可以对接 Spring Cloud 微服务,还可以对接其他类型的后端服务,如静态资源服务、API 服务等。同时,MSE 网关也可以在 Kubernetes 等容器化平台上部署,提供稳定和高效的服务治理和流量控制能力。
    如果您需要将静态资源服务接入 MSE 网关,并将其部署在 Kubernetes 上,可以按照以下步骤操作:

    配置静态资源服务:在部署静态资源服务时,需要将静态资源文件放置于一个可访问的路径下,并配置相应的访问 URL。例如,可以将静态资源文件放置于 /usr/share/nginx/html 目录下,并将 URL 配置为 /static。

    配置 MSE 网关:在配置 MSE 网关时,需要将静态资源服务的 URL 添加到服务注册表中,并配置相应的路由规则。例如,可以将静态资源服务的 URL 添加到 MSE 网关的服务注册表中,并将路由规则配置为将 /static 的请求转发到静态资源服务的 URL。

    部署 MSE 网关:在部署 MSE 网关时,可以将其部署在 Kubernetes 等容器化平台上,并配置相应的容器资源、网络和存储等参数。同时,需要配置 MSE 网关的服务注册中心和路由规则,以确保静态资源服务能够正确地被访问和路由。

    2023-07-30 21:19:34
    赞同 展开评论 打赏
  • native编译添加-H:+AddAllCharsets可以暂时绕过这个问题

    原回答者GitHub用户zcw159357

    2023-07-06 10:37:29
    赞同 展开评论 打赏
  • 这个日志显示了一个Java应用程序中的异常堆栈跟踪。根据日志信息,可以看出有几个问题:

    1. 在调用test()方法时出现了java.lang.reflect.UndeclaredThrowableException异常。
    2. UndeclaredThrowableException的原因是InvocationTargetException,该异常被抛出在通过反射调用方法时遇到异常。
    3. InvocationTargetException的原因是ExceptionInInitializerError,该异常指示静态初始化期间发生错误。
    4. ExceptionInInitializerError的原因是UnsupportedCharsetException,即不支持字符集"Big5"。

    从日志中可以推断出以下一些信息:

    • 该应用程序使用了Spring Boot、Seata和MSE网关。
    • 应用程序可能在连接数据库时遇到了问题,特别是关于字符集的问题,因为引发了UnsupportedCharsetException异常。
    • XAUtils.createXAConnection方法中创建XA连接时出现了问题。

    要解决此问题,你可以尝试以下几个步骤:

    1. 检查数据库配置,确保数据库连接字符串、用户名和密码正确,并且数据库已启动并可访问。
    2. 检查应用程序的字符集设置,确保与数据库的字符集匹配。如果数据库使用"Big5"字符集,请确保应用程序也配置为使用相同的字符集。
    3. 确认是否正确设置了Seata和MSE网关以与应用程序集成。确保所有依赖项和配置都正确。
    4. 查看Seata和MSE网关的文档,了解如何正确配置和使用它们,并根据需要进行调整。

    如果问题仍然存在,请提供更多上下文信息和配置细节,以便可以更好地帮助你解决问题。

    2023-07-05 19:18:38
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
阿里云容器 AHAS Sentinel 网关流控揭秘 立即下载
阿里Tengine网关最佳实践 立即下载
《MSE 微服务网关》 立即下载

相关镜像