WSO2 APIM和BAM - 如何解决空值问题?

时间:2014-02-13 19:24:56

标签: configuration wso2

我使用的是WSO2 API Manager 1.6.0和BAM 2.4.0。

尝试收集统计信息时,我在BAM中收到此错误:

TID: [0] [BAM] [2014-02-13 10:46:17,841] ERROR {org.wso2.carbon.hadoop.hive.jdbc.storage.db.DBOperation} -  Failed to write data to database {org.wso2.carbon.hadoop.hive.jdbc.storage.db.DBOperation}
java.sql.SQLException: Cannot insert the value NULL into column 'consumerKey', table 'wso2_regdb.dbo.API_REQUEST_SUMMARY'; column does not allow nulls. INSERT fails.
        at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
        at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
        at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
        at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
        at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613)
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572)
        at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedStatement.java:727)
        at org.wso2.carbon.hadoop.hive.jdbc.storage.db.DBOperation.insertData(DBOperation.java:175)
        at org.wso2.carbon.hadoop.hive.jdbc.storage.db.DBOperation.writeToDB(DBOperation.java:63)
        at org.wso2.carbon.hadoop.hive.jdbc.storage.db.DBRecordWriter.write(DBRecordWriter.java:35)
        at org.apache.hadoop.hive.ql.exec.FileSinkOperator.processOp(FileSinkOperator.java:589)
        at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:471)
        at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:762)
        at org.apache.hadoop.hive.ql.exec.SelectOperator.processOp(SelectOperator.java:84)
        at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:471)
        at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:762)
        at org.apache.hadoop.hive.ql.exec.SelectOperator.processOp(SelectOperator.java:84)
        at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:471)
        at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:762)
        at org.apache.hadoop.hive.ql.exec.GroupByOperator.forward(GroupByOperator.java:964)
        at org.apache.hadoop.hive.ql.exec.GroupByOperator.closeOp(GroupByOperator.java:1016)
        at org.apache.hadoop.hive.ql.exec.Operator.close(Operator.java:557)
        at org.apache.hadoop.hive.ql.exec.ExecReducer.close(ExecReducer.java:304)
        at org.apache.hadoop.mapred.ReduceTask.runOldReducer(ReduceTask.java:528)
        at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:419)
        at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:257)

我意识到我可以简单地允许consumerkey允许空值...但是更新WSo2定义的DDL似乎是一个坏主意。

我认为这可能与API管理器在尝试使用“tryit”功能时遇到的问题有关,但未正确接收密钥。我会收到错误:

TID: [0] [AM] [2014-02-13 14:25:02,513] ERROR {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} -  API authentication failure {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler}
org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException: Access failure for API: /APIPhoneVerify, version: 2.0.0 with key: null

我之前发布了'tryit'问题,并被告知我根据http://docs.wso2.org/display/AM160/Adding+Documentation+Using+Swagger更新了我的配置,但我没有帮助。

有关如何清除BAM错误的任何想法?和/或修复'tryit'功能?

1 个答案:

答案 0 :(得分:0)

尝试使用try it功能访问API时,似乎会发生NULL值插入。这将发送一个飞行前OPTION请求,以查看是否允许浏览器访问该资源,并且此请求不会发送访问令牌。由于它是通过访问令牌,导出了消费者密钥,当OPTIONS请求通过网关时,将无法找到与之关联的消费者密钥 - 因此空值将被推送到BAM。这似乎是一个错误,您可以在https://wso2.org/jira/browse/APIMANAGER报告此问题。

但是,NULL值插入对调用API没有任何影响。根据提供的错误,从tryit发送的请求(实际请求,而不是在飞行前的请求)似乎没有发送访问令牌。