首页 > 数据库技术 > 详细

Tigase8.x 搭配Mysql8及以上启动时报错(Nodes redirection table: tig_cluster_nodes doesn't exits)的解决方法

时间:2021-03-02 20:10:57      阅读:18      评论:0      收藏:0      [点我收藏+]

Tigase 启动时报如下错误:

=====================
Could not initialize bean default (class: class tigase.server.xmppclient.SeeOtherHostDualIP$DualIPRepositoryWrapper$DualIPRepositoryWrapperConfigBean), skipping injection of this bean
RootCause:
   -> java.lang.RuntimeException: Repository initialization failed
      [tigase.server.xmppclient.SeeOtherHostDualIPSQLRepository.setDataSource(SeeOtherHostDualIPSQLRepository.java:61)]
      -> java.sql.SQLException: Nodes redirection table: tig_cluster_nodes doesn‘t exits!
         [tigase.server.xmppclient.SeeOtherHostDualIPSQLRepository.checkDB(SeeOtherHostDualIPSQLRepository.java:103)]
=====================

 

项目中数据库链接的配置:

 uri = ‘jdbc:mysql://localhost/tig8_db?user=root&password=123456&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai‘

 

1、分析问题: 通过定位发现此为Tigase的兼容BUG,导致问题源代码处:

tigase.db.jdbc.DataRepositoryImpl

if (db_conn != null) {
			switch (database) {
				case jtds:
				case sqlserver:
					table_schema = "dbo";
					break;
				case postgresql:
					table_schema = "public";
					break;
				default:
					String[] slashes = db_conn.split("/");
					table_schema = slashes[slashes.length - 1].split("\\?")[0];
					break;
			}
			log.log(Level.INFO, "Table schema found: {0}, database type: {1}, database driver: {2}",
					new Object[]{table_schema, database.toString(), driverClass});
		}

 

2、定位到问题点: 如果使用的是Mysql8及以上,URL需要配置时区 :serverTimezone=Asia/Shanghai‘,则以下代码切割出来的table_schema 为Shanghai,导致取不正确的值tig8_db,从而报错!  

String[] slashes = db_conn.split("/");
table_schema = slashes[slashes.length - 1].split("\\?")[0]; // error ==> Shanghai

  

3、解决问题: 在官方还没修复之前,通过以下方式可以修复:

String[] slashes = db_conn.split("/");
for (String slash : slashes) {
    if (slash != null && slash.contains("?")) {
        table_schema = slash.split("\\?")[0];
        break;
    }
}

  

 

Tigase8.x 搭配Mysql8及以上启动时报错(Nodes redirection table: tig_cluster_nodes doesn't exits)的解决方法

原文:https://www.cnblogs.com/eyecool/p/14470651.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!