微服务框架只能使用一种数据源吗?主数据库使用postgresql,xxljob-admin启动报错

Blade 未结 2 955
81809956
81809956 2022-06-04 12:14

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

1. 主库使用postgresql,xxljob-admin使用mysql数据库同,启动xxljob-admin时报错

2. 

3.


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

期望:xxljob-admin正常使用mysql,可以与主体使用不同数据库

实际: Cannot load driver class: org.postgresql.Driver



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

商业 bladex版 2.9.1

windows


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


2022-06-04 12:08:04.048  INFO 14516 --- [           main] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] RpcClient init label, labels = {module=config, Vipserver-Tag=null, source=sdk, Amory-Tag=null, Location-Tag=null, taskId=0, AppName=unknown}

2022-06-04 12:08:04.048  INFO 14516 --- [           main] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] Register server push request handler:com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient$$Lambda$272/237484673

2022-06-04 12:08:04.048  INFO 14516 --- [           main] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] Register server push request handler:com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient$$Lambda$273/1412656257

2022-06-04 12:08:04.049  INFO 14516 --- [           main] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] Registry connection listener to current client:com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient$1

2022-06-04 12:08:04.049  INFO 14516 --- [           main] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] RpcClient init, ServerListFactory = com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient$2

2022-06-04 12:08:04.056  INFO 14516 --- [           main] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] Try to connect to server on start up, server: {serverIp = '192.168.12.144', server main port = 8848}

2022-06-04 12:08:05.331  INFO 14516 --- [           main] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] Success to connect to server [192.168.12.144:8848] on start up, connectionId = 1654315683548_192.168.12.51_59033

2022-06-04 12:08:05.335  INFO 14516 --- [t.remote.worker] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] Notify connected event to listeners.

2022-06-04 12:08:05.336  INFO 14516 --- [           main] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$ConnectResetRequestHandler

2022-06-04 12:08:05.337  INFO 14516 --- [           main] com.alibaba.nacos.common.remote.client   : [d45bfdc7-7505-4061-ad70-a638023dced8_config-0] Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$$Lambda$282/1076462213

2022-06-04 12:08:05.440  WARN 14516 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[blade-xxljob-admin] & group[DEFAULT_GROUP]

2022-06-04 12:08:05.446  WARN 14516 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[blade-xxljob-admin.yaml] & group[DEFAULT_GROUP]

2022-06-04 12:08:05.455  WARN 14516 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[blade-xxljob-admin-dev.yaml] & group[DEFAULT_GROUP]

2022-06-04 12:08:05.456  INFO 14516 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-blade-xxljob-admin-dev.yaml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-blade-xxljob-admin.yaml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-blade-xxljob-admin,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-blade-dev.yaml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-blade.yaml,DEFAULT_GROUP'}]

2022-06-04 12:08:05.461  INFO 14516 --- [           main] com.xxl.job.admin.JobAdminApplication    : The following profiles are active: dev

2022-06-04 12:08:06.504  INFO 14516 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!

2022-06-04 12:08:06.510  INFO 14516 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.

2022-06-04 12:08:06.551  INFO 14516 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 26ms. Found 0 Redis repository interfaces.

2022-06-04 12:08:06.627  WARN 14516 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.

2022-06-04 12:08:06.795  INFO 14516 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=e2178f20-8945-3ae7-8d56-00fe68bf9573

2022-06-04 12:08:06.798  INFO 14516 --- [           main] s.c.l.p.BladePropertySourcePostProcessor : BladePropertySourcePostProcessor init.

2022-06-04 12:08:06.798  INFO 14516 --- [           main] s.c.l.p.BladePropertySourcePostProcessor : BladePropertySourcePostProcessor process @BladePropertySource bean.

2022-06-04 12:08:06.846  WARN 14516 --- [           main] s.c.l.p.BladePropertySourcePostProcessor : Not found @BladePropertySource on spring bean class.

2022-06-04 12:08:07.331  INFO 14516 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.cloud.sentinel-com.alibaba.cloud.sentinel.SentinelProperties' of type [com.alibaba.cloud.sentinel.SentinelProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

INFO: Sentinel log output type is: file

INFO: Sentinel log charset is: utf-8

INFO: Sentinel log base directory is: C:\Users\ASUS\logs\csp\

INFO: Sentinel log name use pid is: false

2022-06-04 12:08:07.484  INFO 14516 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'com.alibaba.cloud.sentinel.custom.SentinelAutoConfiguration' of type [com.alibaba.cloud.sentinel.custom.SentinelAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2022-06-04 12:08:07.743  WARN 14516 --- [           main] io.undertow.websockets.jsr               : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used

2022-06-04 12:08:07.770  INFO 14516 --- [           main] io.undertow.servlet                      : Initializing Spring embedded WebApplicationContext

2022-06-04 12:08:07.771  INFO 14516 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2299 ms

2022-06-04 12:08:07.932  WARN 14516 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.

2022-06-04 12:08:07.932  INFO 14516 --- [           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.

2022-06-04 12:08:07.947  INFO 14516 --- [           main] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@7d626f2

2022-06-04 12:08:08.632  INFO 14516 --- [           main] c.x.j.a.core.scheduler.XxlJobScheduler   : >>>>>>>>> init xxl-job admin success.

2022-06-04 12:08:08.646  WARN 14516 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.

2022-06-04 12:08:08.646  INFO 14516 --- [           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.

2022-06-04 12:08:08.655  INFO 14516 --- [LogReportHelper] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2022-06-04 12:08:08.660  INFO 14516 --- [ryMonitorHelper] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2022-06-04 12:08:08.660  INFO 14516 --- [ilMonitorHelper] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2022-06-04 12:08:08.663 ERROR 14516 --- [ryMonitorHelper] c.x.j.a.c.t.JobRegistryMonitorHelper     : >>>>>>>>>>> xxl-job, job registry monitor thread error:{}


org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: java.lang.RuntimeException: Driver org.postgresql.Driver claims to not accept jdbcUrl, ${blade.datasource.job.dev.url}

### The error may exist in file [G:\javawork\bladex_demo\bladex2.9.1\blade-ops\blade-xxljob-admin\target\classes\mybatis-mapper\XxlJobGroupMapper.xml]

### The error may involve com.xxl.job.admin.dao.XxlJobGroupDao.findByAddressType

### The error occurred while executing a query

### Cause: java.lang.RuntimeException: Driver org.postgresql.Driver claims to not accept jdbcUrl, ${blade.datasource.job.dev.url}


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

2条回答
  •  81809956
    81809956 (楼主)
    2022-06-06 08:55

    问题是  xxljob-admin 指定的是 mysql 数据源,但它加载的驱动还是postgresqld驱动

    blade-xxljob-admin-dev.yml

    spring:
    datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    druid:
    validation-query: select 1
    blade:
    datasource:
    job:
    dev:
    # MySql
    url: jdbc:mysql://192.168.12.12:3306/xxl_job?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
    username: root
    password: 123





提交回复