blade-gateway.jar 启动不了

Blade 已结 1 556
407673005
407673005 剑童 2021-12-29 19:53

一、该问题的重现步骤是什么?

1. 同一台服务器部署sentinel,nacos。blade-gateway正常启动

2. sentinel,nacos部署在另外一台服务器,则blade-gateway启动不了

3. 


二、你期待的结果是什么?实际看到的又是什么?


三、你正在使用的是什么产品,什么版本?在什么操作系统上?


四、请提供详细的错误堆栈信息,这很重要。

2021-12-29 19:38:17.308  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [cb05eecf-74b9-4033-96a6-946facd402ab_config-0]Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$ConnectResetRequestHandler

2021-12-29 19:38:17.308  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [cb05eecf-74b9-4033-96a6-946facd402ab_config-0]Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$4

2021-12-29 19:38:17.310  INFO 604623 --- [t.remote.worker] com.alibaba.nacos.common.remote.client   : [cb05eecf-74b9-4033-96a6-946facd402ab_config-0]Notify connected event to listeners.

2021-12-29 19:38:17.310  INFO 604623 --- [t.remote.worker] c.a.n.client.config.impl.ClientWorker    : [cb05eecf-74b9-4033-96a6-946facd402ab_config-0] Connected,notify listen context...

2021-12-29 19:38:17.579  WARN 604623 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.

2021-12-29 19:38:17.580  INFO 604623 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

2021-12-29 19:38:17.591  WARN 604623 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.

2021-12-29 19:38:17.591  INFO 604623 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [After]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Before]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Between]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Cookie]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Header]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Host]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Method]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Path]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Query]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [ReadBody]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [RemoteAddr]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Weight]

2021-12-29 19:38:19.028  INFO 604623 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [CloudFoundryRouteService]

2021-12-29 19:38:19.248  INFO 604623 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null

2021-12-29 19:38:19.249  INFO 604623 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Environment :null

2021-12-29 19:38:19.249  INFO 604623 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null

2021-12-29 19:38:19.278  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [RpcClientFactory] create a new rpc client of 2af2a87c-4e17-4934-afd7-88793b53dc7a

2021-12-29 19:38:19.278  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [2af2a87c-4e17-4934-afd7-88793b53dc7a]RpcClient init label, labels={module=naming, source=sdk}

2021-12-29 19:38:19.279  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [2af2a87c-4e17-4934-afd7-88793b53dc7a]RpcClient init, ServerListFactory =com.alibaba.nacos.client.naming.core.ServerListManager

2021-12-29 19:38:19.279  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [2af2a87c-4e17-4934-afd7-88793b53dc7a] Try to connect to server on start up, server: {serverIp='39.108.82.41', server main port=8848}

2021-12-29 19:38:19.406  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [2af2a87c-4e17-4934-afd7-88793b53dc7a] Success to connect to server [39.108.82.41:8848] on start up,connectionId=1640777899291_47.106.184.212_42948

2021-12-29 19:38:19.406  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [2af2a87c-4e17-4934-afd7-88793b53dc7a]Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$ConnectResetRequestHandler

2021-12-29 19:38:19.406  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [2af2a87c-4e17-4934-afd7-88793b53dc7a]Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$4

2021-12-29 19:38:19.407  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [2af2a87c-4e17-4934-afd7-88793b53dc7a]Register server push request handler:com.alibaba.nacos.client.naming.remote.gprc.NamingPushRequestHandler

2021-12-29 19:38:19.408  INFO 604623 --- [           main] com.alibaba.nacos.common.remote.client   : [2af2a87c-4e17-4934-afd7-88793b53dc7a]Registry connection listener to current client:com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcConnectionEventListener

021-12-29 19:38:19.451  WARN 604623 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webHandler' defined in class path resource [org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration$EnableWebFluxConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webEndpointReactiveHandlerMapping' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping]: Factory method 'webEndpointReactiveHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.mysql.cj.jdbc.Driver

2021-12-29 19:38:19.506  INFO 604623 --- [           main] ConditionEvaluationReportLoggingListener :


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2021-12-29 19:38:19.539 ERROR 604623 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webHandler' defined in class path resource [org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration$EnableWebFluxConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webEndpointReactiveHandlerMapping' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping]: Factory method 'webEndpointReactiveHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.mysql.cj.jdbc.Driver

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) ~[spring-beans-5.2.15.RELEASE.jar!/:5.2.15.RELEASE]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.15.RELEASE.jar!/:5.2.15.RELEASE]

        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.15.RELEASE.jar!/:5.2.15.RELEASE]

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.15.RELEASE.jar!/:5.2.15.RELEASE]

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.15.RELEASE.jar!/:5.2.15.RELEASE]

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.15.RELEASE.jar!/:5.2.15.RELEASE]

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.15.RELEASE.jar!/:5.2.15.RELEASE]

        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.15.RELEASE.jar!/:5.2.15.RELEASE]

        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.15.RELEASE.jar!/:5.2.15.RELEASE]

        at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:62) ~[spring-boot-2.3.12.RELEASE.jar!/:2.3.12.RELEASE]

        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755) ~[spring-boot-2.3.12.RELEASE.jar!/:2.3.12.RELEASE]

        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.3.12.RELEASE.jar!/:2.3.12.RELEASE]

        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402) ~[spring-boot-2.3.12.RELEASE.jar!/:2.3.12.RELEASE]

        at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.3.12.RELEASE.jar!/:2.3.12.RELEASE]

        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.3.12.RELEASE.jar!/:2.3.12.RELEASE]

        at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:50) [blade-core-launch-2.8.2.RELEASE.jar!/:na]

        at org.springblade.gateway.GateWayApplication.main(GateWayApplication.java:36) [classes!/:na]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]

        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]

        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [blade-gateway.jar:na]

        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [blade-gateway.jar:na]

        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [blade-gateway.jar:na]

        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [blade-gateway.jar:na]

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webEndpointReactiveHandlerMapping' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping]: Factory method 'webEndpointReactiveHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in cl

五、若有更多详细信息,请在下面提供。

nacos blade-prod.yaml 配置

#spring配置

spring:

redis:

##redis 单机环境配置

##将docker脚本部署的redis服务映射为宿主机ip

##生产环境推荐使用阿里云高可用redis服务并设置密码

host: 127.0.0.1

port: 6379

password: redis123

database: 0

ssl: false

##redis 集群环境配置

#cluster:

#  nodes: 127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003

#  commandTimeout: 5000

datasource:

driver-class-name: com.mysql.cj.jdbc.Driver

#driver-class-name: org.postgresql.Driver

#driver-class-name: oracle.jdbc.OracleDriver

#driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver

druid:

# MySql、PostgreSQL、SqlServer校验

validation-query: select 1

# Oracle校验

#validation-query: select 1 from dual


#项目模块集中配置

blade:

#分布式锁配置

lock:

##是否启用分布式锁

enabled: false

##将docker脚本部署的redis服务映射为宿主机ip

##生产环境推荐使用阿里云高可用redis服务并设置密码

address: redis://127.0.0.1:6379

#通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖)

datasource:

prod:

url: jdbc:mysql://127.0.0.1:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true

username: root

password: 密码


1条回答
  •  zhx1994
    zhx1994 (最佳回答者)
    2021-12-29 21:09

    你是不是改网关的依赖了。

    怎么会去加载数据库的驱动?

    'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: com.mysql.cj.jdbc.Driver

    0 讨论(1)
提交回复