1 问题
EOS开发应用的时候,可以采用多数据源。
项目启动的是时候报错如下:
2024-08-14 16:03:56.105 ERROR [EOS-DEMO-SYS,EOSLOWCODE,default,cuipengyu:EOSLOWCODE:28015,,,,] 28960 --- [Timer-0] c.p.g.a.a.m.RdcloudStatisticsThread : UserInfo: null, DataSourceInfo: [init=10, min=10, max=50, idle=10, busy=0, unclosedOrphaned=0], Thread: Thread[Timer-0,5,main], CPU: 100%, SystemMemory: 94% [total:8075MB, free:430MB, used:7645MB], JvmMemory: 54% [max:1796MB, total:841MB, free:384MB, used:457MB]
ErrCode: 14101000
Message: 未知异常(Table 'kgptdemo.rdc_con_user_statistics_day' doesn't exist)
com.eos.das.entity.DASEntityRuntimeException: ErrCode: 14101000
Message: 未知异常(Table 'kgptdemo.rdc_con_user_statistics_day' doesn't exist)
at com.primeton.das.entity.impl.exception.DASExceptionHelper.convert(DASExceptionHelper.java:176) ~[eos-ptp-das-entity-8.3.1.jar:na]
at com.primeton.das.entity.impl.DASSessionImpl.countBySubQuery(DASSessionImpl.java:497) ~[eos-ptp-das-entity-8.3.1.jar:na]
或者如下
2024-08-14 16:03:54.001 ERROR [EOS-DEMO-SYS,EOSLOWCODE,default,cuipengyu:EOSLOWCODE:28015,,,,] 28960 --- [xxl-job, admin JobScheduleHelper#scheduleThread] .i.s.TraceLoggerStatementSynchronization : UserInfo: null, DataSourceInfo: [init=10, min=10, max=50, idle=9, busy=1, unclosedOrphaned=0], Thread: Thread[xxl-job, admin JobScheduleHelper#scheduleThread,5,main], CPU: 57%, SystemMemory: 94% [total:8075MB, free:432MB, used:7643MB], JvmMemory: 26% [max:1796MB, total:841MB, free:616MB, used:225MB]
Sql[select * from xxl_job_lock where lock_name = 'schedule_lock' for update] execute error.
java.sql.SQLSyntaxErrorException: Table 'kgptdemo.xxl_job_lock' doesn't exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.17.jar:8.0.17]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.17.jar:8.0.17]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.17.jar:8.0.17]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) ~[mysql-connector-java-8.0.17.jar:8.0.17]
at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:370) ~[mysql-connector-java-8.0.17.jar:8.0.17]
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.execute(NewProxyPreparedStatement.java:67) ~[c3p0-0.9.5.4.jar:0.9.5.4]
at com.primeton.ext.infra.connection.PreparedStatementWrapper.execute(PreparedStatementWrapper.java:62) ~[eos-ptp-jdbc-connection-8.3.1.jar:na]
at com.xxl.job.admin.core.thread.JobScheduleHelper$1.run(JobScheduleHelper.java:75) [xxl-job-admin-2.4.0.3.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_271]
2024-08-14 16:03:54.002 ERROR [EOS-DEMO-SYS,EOSLOWCODE,default,cuipengyu:EOSLOWCODE:28015,,,,] 28960 --- [xxl-job, admin JobScheduleHelper#scheduleThread] c.x.j.a.core.thread.JobScheduleHelper : >>>>>>>>>>> xxl-job, JobScheduleHelper#scheduleThread error:{}
java.sql.SQLSyntaxErrorException: Table 'kgptdemo.xxl_job_lock' doesn't exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.17.jar:8.0.17]
看问题,是缺少数据表。
2 解决办法
多数据源中,default数据库采用Afcenter的数据库,其他业务数据库需要执行一下3个SQL
eos根路径\server\afcenter\db-scripts\eos\Mysql\all.sql
eos根路径\server\afcenter\db-scripts\bfp-framework\Mysql\all.sql
eos根路径\server\afcenter\db-scripts\lowcode\Mysql\all.sql
这3个文件也可以精简版的文件夹下找到
eos精简版根路径\db-scripts\single\eos\Mysql\all.sql
eos精简版根路径\db-scripts\single\bfp-framework\Mysql\all.sql
eos精简版根路径\db-scripts\single\lowcode\Mysql\all.sql