恢复备份后WSO2AM-3.2.0无法启动,报MB_NODE表不存在错误
WSO2 API Manager 3.2.0 恢复启动失败问题
问题描述
现有WSO2AM-3.2.0实例损坏,从11月28日备份恢复到新服务器后,实例指向现有Postgres数据库,但服务器无法启动,抛出以下错误:
TID: [-1234] [] [2022-12-23 07:52:28,130] ERROR {org.wso2.andes.server.registry.ApplicationRegistry} - org.wso2.andes.kernel.AndesException: Error occurred while retrieving all node information. TID: [-1234] [] [2022-12-23 07:52:28,131] ERROR {org.wso2.andes.server.Main} - Exception during startup. Triggering shutdown org.wso2.andes.kernel.AndesException: Unable to initialise application registry at org.wso2.andes.server.Broker.startupImpl(Broker.java:312) Caused by: java.lang.Exception: org.wso2.andes.kernel.AndesException: Error occurred while retrieving all node information. at org.wso2.andes.server.registry.ApplicationRegistry.initialise(ApplicationRegistry.java:266) at org.wso2.andes.server.registry.ApplicationRegistry.initialise(ApplicationRegistry.java:147) at org.wso2.andes.server.Broker.startupImpl(Broker.java:279) ... 56 more Caused by: org.wso2.andes.kernel.AndesException: Error occurred while retrieving all node information. at org.wso2.andes.store.rdbms.RDBMSStoreUtils.convertSQLException(RDBMSStoreUtils.java:128) at org.wso2.andes.store.rdbms.RDBMSAndesContextStoreImpl.getAllStoredNodeData(RDBMSAndesContextStoreImpl.java:419) Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "MB_NODE" not found; SQL statement: SELECT NODE_ID,NODE_DATA FROM MB_NODE [42102-199] at org.h2.message.DbException.getJdbcSQLException(DbException.java:451)
解决方案
错误核心是启动时系统尝试访问H2数据库的MB_NODE表,但实际配置的是Postgres,说明消息代理(Andes)的数据库配置未正确指向Postgres,或备份中保留了H2的配置。按以下步骤修复:
检查消息代理数据库配置
打开<APIM_HOME>/repository/conf/broker.xml,找到<database>配置段,确认:<url>为Postgres的JDBC URL(格式:jdbc:postgresql://<postgres-host>:5432/<mb-db-name>)<username>和<password>是Postgres的正确凭据<driverClassName>为org.postgresql.Driver
确保未配置为H2的URL(如jdbc:h2:./repository/database/WSO2MB_DB)
验证Postgres中MB相关表
登录Postgres数据库,检查是否存在MB_NODE、MB_QUEUE等消息代理表。若缺失,执行<APIM_HOME>/dbscripts/mb/postgresql.sql脚本创建表结构,再从备份恢复MB相关数据(如有)清除本地H2数据库文件
删除<APIM_HOME>/repository/database/WSO2MB_DB.*文件,避免系统优先读取本地H2库检查主数据源配置
打开<APIM_HOME>/repository/conf/datasources/master-datasources.xml,确认WSO2MB_DB数据源正确指向Postgres:<datasource> <name>WSO2MB_DB</name> <description>The datasource used for Message Broker database</description> <jndiConfig> <name>jdbc/WSO2MB_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:postgresql://<postgres-host>:5432/<mb-db-name></url> <username>postgres</username> <password>password</password> <driverClassName>org.postgresql.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>重启服务器验证
完成配置修改和表创建后,重新启动WSO2AM服务器,检查启动日志是否消除该错误
内容的提问来源于stack exchange,提问作者PradeepKumar
相关产品推荐
相关产品推荐

