WSO2 API Manager因磁盘空间不足而失败,重启后无法正常工作

时间:2017-10-20 13:06:48

标签: wso2 wso2-am wso2carbon

WSO2 API Manager 2.0.0实例正常运行,直到ec2实例耗尽磁盘空间。清除磁盘并重新启动API Manager后,它会不断抛出错误。它创建访问令牌但不能持久/验证。

错误详情:

    TID: [-1234] [] [2017-10-20 09:43:14,684]  INFO {org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO} -  Thread pool size for session persistent consumer : 100 {org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO}
TID: [-1] [] [2017-10-20 09:43:15,495] ERROR {org.wso2.carbon.identity.oauth2.dao.TokenPersistenceTask} -  Error occurred while persisting access token :b4f68332-4359-3718-a553-3d908618b1c6 {org.wso2.carbon.identity.oauth2.dao.TokenPersistenceTask}
org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception: Error when storing the access token for consumer key : _hWq2BEkf1kB2RFSzugOzF04VRsa
    at org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO.storeAccessToken(TokenMgtDAO.java:291)
    at org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO.persistAccessToken(TokenMgtDAO.java:343)
    at org.wso2.carbon.identity.oauth2.dao.TokenPersistenceTask.run(TokenPersistenceTask.java:52)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: rowCount expected 663 got 665 IDN_OAUTH2_ACCESS_TOKEN.PRIMARY_KEY_F"; SQL statement:
INSERT INTO IDN_OAUTH2_ACCESS_TOKEN (ACCESS_TOKEN, REFRESH_TOKEN, CONSUMER_KEY_ID, AUTHZ_USER, TENANT_ID, USER_DOMAIN, TIME_CREATED, REFRESH_TOKEN_TIME_CREATED, VALIDITY_PERIOD, REFRESH_TOKEN_VALIDITY_PERIOD, TOKEN_SCOPE_HASH, TOKEN_STATE, USER_TYPE, TOKEN_ID, GRANT_TYPE, SUBJECT_IDENTIFIER) SELECT ?,?,ID,?,?,?,?,?,?,?,?,?,?,?,?,? FROM IDN_OAUTH_CONSUMER_APPS WHERE CONSUMER_KEY=? [50000-140]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
    at org.h2.message.DbException.get(DbException.java:156)
    at org.h2.message.DbException.convert(DbException.java:279)
    at org.h2.table.RegularTable.addRow(RegularTable.java:134)
    at org.h2.command.dml.Insert.insertRows(Insert.java:148)
    at org.h2.command.dml.Insert.update(Insert.java:82)
    at org.h2.command.CommandContainer.update(CommandContainer.java:70)
    at org.h2.command.Command.executeUpdate(Command.java:199)
    at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:179)
    at org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO.storeAccessToken(TokenMgtDAO.java:269)
    ... 5 more
Caused by: java.lang.RuntimeException: rowCount expected 663 got 665 IDN_OAUTH2_ACCESS_TOKEN.PRIMARY_KEY_F
    at org.h2.message.DbException.throwInternalError(DbException.java:226)
    at org.h2.table.RegularTable.checkRowCount(RegularTable.java:144)
    at org.h2.table.RegularTable.addRow(RegularTable.java:117)
    ... 11 more
TID: [-1] [] [2017-10-20 09:43:16,236]  INFO {org.wso2.carbon.event.processor.manager.core.internal.CarbonEventManagementService} -  Starting polling event receivers {org.wso2.carbon.event.processor.manager.core.internal.CarbonEventManagementService}

1 个答案:

答案 0 :(得分:1)

看起来您的H2数据库已损坏。您可以通过清除H2数据库来恢复此数据,但是您将丢失数据。

rm -r <APIM_HOME>/repository/database/* 

然后使用-Dsetup

启动服务器
./wso2server.sh -Dsetup

这将再次创建H2数据库。

WSO2的建议是由于这个确切的原因(即H2数据库的可破坏性质)不在生产中使用H2。