0

我有一个配置为使用 PostgreSQL 的 WSO2 API Manager v1.4.0。

注册后,用户无法登录商店并在控制台中引发异常。我还尝试使用默认管理员帐户登录。

使用 MySQL 作为 DBMS 或登录到发布者 Web UI 时不会发生该错误。

如何修复此错误?

完整的堆栈跟踪:

[2013-08-08 15:47:59,974] ERROR - JDBCUserStoreManager Cannot change transaction isolation level in the middle of a transaction.
org.postgresql.util.PSQLException: Cannot change transaction isolation level in the middle of a transaction.
        at org.postgresql.jdbc2.AbstractJdbc2Connection.setTransactionIsolation(AbstractJdbc2Connection.java:819)

(...)

[2013-08-08 15:47:59,980]  WARN - CarbonAuthenticationUtil Failed Administrator login attempt 'admin[-1234]' at [2013-08-08 15:47:59,980+0200]
[2013-08-08 15:47:59,981]  WARN - AuthenticationHandler Illegal access attempt at [2013-08-08 15:47:59,0981] from IP address 185.12.7.138 while trying to authenticate access to service UserAdmin
[2013-08-08 15:47:59,982] ERROR - AUDIT_LOG Illegal access attempt at [2013-08-08 15:47:59,0981] from IP address 185.12.7.138 while trying to authenticate access to service UserAdmin
[2013-08-08 15:47:59,983] ERROR - AxisEngine Access Denied. Authentication failed - System error occurred. Please check server logs for more details.
org.apache.axis2.AxisFault: Access Denied. Authentication failed - System error occurred. Please check server logs for more details.
        at org.wso2.carbon.server.admin.module.handler.AuthenticationHandler.authenticate(AuthenticationHandler.java:103)

(...)

[2013-08-08 15:47:59,990] ERROR - APIStoreHostObject Error occurred while checking for multiple user stores
[2013-08-08 15:48:00,045]  INFO - CarbonAuthenticationUtil 'admin@carbon.super [-1234]' logged in at [2013-08-08 15:48:00,044+0200]
[2013-08-08 15:48:00,124] ERROR - ApiMgtDAO Failed to get Subscriber for :admin
org.postgresql.util.PSQLException: ERROR: relation "am_subscriber" does not exist
  Position: 97
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2101)

(...)

[2013-08-08 15:47:59,978] ERROR - JDBCUserStoreManager Using sql : null
[2013-08-08 15:47:59,978] ERROR - BasicAccessAuthenticator Unable to get UserStoreManager for authentication. User - admin
org.wso2.carbon.user.core.UserStoreException: Authentication Failure
        at org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager.doAuthenticate(JDBCUserStoreManager.java:810)

(...)

[2013-08-08 15:48:00,129] ERROR - APIStoreHostObject Error while getting Subscriber
org.wso2.carbon.apimgt.api.APIManagementException: Failed to get Subscriber
        at org.wso2.carbon.apimgt.impl.AbstractAPIManager.handleException(AbstractAPIManager.java:621)

(...)

Caused by: org.wso2.carbon.apimgt.api.APIManagementException: Failed to get Subscriber for :admin
        at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.handleException(ApiMgtDAO.java:3911)
        at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.getSubscriber(ApiMgtDAO.java:917)
        at org.wso2.carbon.apimgt.impl.APIConsumerImpl.getSubscriber(APIConsumerImpl.java:87)
        ... 52 more
Caused by: org.postgresql.util.PSQLException: ERROR: relation "am_subscriber" does not exist
  Position: 97
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2101)

(...)

[2013-08-08 15:48:00,133] ERROR - RhinoEngine org.mozilla.javascript.WrappedException: Wrapped org.wso2.carbon.apimgt.api.APIManagementException: Error while getting Subscriber (/store/modules/user/
login.jag#30)
[2013-08-08 15:48:00,134] ERROR - WebAppManager org.mozilla.javascript.WrappedException: Wrapped org.wso2.carbon.apimgt.api.APIManagementException: Error while getting Subscriber (/store/modules/use
r/login.jag#30)
org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.WrappedException: Wrapped org.wso2.carbon.apimgt.api.APIManagementException: Error while getting Subscriber (/store/modu
les/user/login.jag#30)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:446)

(...)

Caused by: org.mozilla.javascript.WrappedException: Wrapped org.wso2.carbon.apimgt.api.APIManagementException: Error while getting Subscriber (/store/modules/user/login.jag#30)
        at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1654)

(...)

Caused by: org.wso2.carbon.apimgt.api.APIManagementException: Error while getting Subscriber
        at org.wso2.carbon.apimgt.hostobjects.APIStoreHostObject.handleException(APIStoreHostObject.java:134)

(...)

Caused by: org.wso2.carbon.apimgt.api.APIManagementException: Failed to get Subscriber
        at org.wso2.carbon.apimgt.impl.AbstractAPIManager.handleException(AbstractAPIManager.java:621)

(...)

Caused by: org.wso2.carbon.apimgt.api.APIManagementException: Failed to get Subscriber for :admin
        at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.handleException(ApiMgtDAO.java:3911)

(...)

Caused by: org.postgresql.util.PSQLException: ERROR: relation "am_subscriber" does not exist
  Position: 97
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2101)

(...)
[2013-08-08 15:48:00,202] ERROR - RhinoEngine org.mozilla.javascript.EcmaError: TypeError: Cannot read property "h1" from undefined (/store/site/themes/fancy/templates/errors/template.jag#18)
[2013-08-08 15:48:00,203] ERROR - WebAppManager org.mozilla.javascript.EcmaError: TypeError: Cannot read property "h1" from undefined (/store/site/themes/fancy/templates/errors/template.jag#18)
org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "h1" from undefined (/store/site/themes/fancy/templates/errors/template.jag#1
8)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:446)

(...)
4

1 回答 1

3

此问题已在 API Manager 的更高版本中修复,您必须在其中添加,

<defaultAutoCommit>true</defaultAutoCommit> 

数据源配置的属性。

另外,删除元素,

<validationQuery>SELECT 1</validationQuery> 

从配置上。

这在https://docs.wso2.com/display/IS510/Setting+up+PostgreSQL

示例如下。

<datasource>
            <name>WSO2AM_DB</name>
            <description>The datasource used for API Manager database</description>
            <jndiConfig>
                <name>jdbc/WSO2AM_DB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url>jdbc:postgresql://localhost:5432/amdb</url>
                    <username>sdpuser</username>
                    <password>sdpuser</password>
                    <defaultAutoCommit>true</defaultAutoCommit>
                    <driverClassName>org.postgresql.Driver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
        </datasource>
于 2017-01-19T23:17:18.667 回答