您目前查看的是 Apigee 和 Apigee Hybrid 說明文件。
查看
Apigee Edge 說明文件。
UnsupportedOperationException
錯誤代碼
java.lang.UnsupportedOperationException
錯誤回應主體
{
"fault":{
"faultstring":"java.lang.UnsupportedOperationException",
"detail":{
"errorcode":"Internal Server Error"
}
}
}
原因
如果「鍵值對應作業」政策中的 mapIdentifier 屬性設為空字串,就會發生這個錯誤。
診斷
檢查發生失敗的特定 API Proxy 中的所有鍵值對應作業政策。如果任何鍵/值對應作業政策的
mapIdentifier屬性設為空字串,就會導致錯誤。舉例來說,下列「鍵/值對應作業」政策的
mapIdentifier為空:<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="StoreKvm" mapIdentifier=""> <DisplayName>StoreKvm</DisplayName> <Properties/> <ExclusiveCache>false</ExclusiveCache> <ExpiryTimeInSecs>300</ExpiryTimeInSecs> <Put override="true"> <Key> <Parameter ref="request.queryparam.key"/> </Key> <Value ref="request.queryparam.value"/> </Put> <Scope>environment</Scope> </KeyValueMapOperations>
解析度
確認「鍵/值對應作業」政策中的 mapIdentifier 屬性已設為有效的鍵/值對應。
如要修正上述範例政策,您可以將 mapIdentifier 指定給現有的鍵值對應 UserLocationMap。
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="StoreKvm" mapIdentifier="UserLocationMap">
<DisplayName>StoreKvm</DisplayName>
<Properties/>
<ExclusiveCache>false</ExclusiveCache>
<ExpiryTimeInSecs>300</ExpiryTimeInSecs>
<Put override="true">
<Key>
<Parameter ref="request.queryparam.key"/>
</Key>
<Value ref="request.queryparam.value"/>
</Put>
<Scope>environment</Scope>
</KeyValueMapOperations>
SetVariableFailed
錯誤代碼
steps.keyvaluemapoperations.SetVariableFailed
錯誤回應主體
{
"fault":{
"faultstring":"Failed to set variable variable_name in KeyValueMapStepDefinition policy_name",
"detail":{
"errorcode":"steps.keyvaluemapoperations.SetVariableFailed"
}
}
}
錯誤訊息範例
{
"fault":{
"faultstring":"Failed to set variable myvar in KeyValueMapStepDefinition EncryptedKVM",
"detail":{
"errorcode":"steps.keyvaluemapoperations.SetVariableFailed"
}
}
}
原因
如果您嘗試從加密鍵值對應表擷取值,並將值設為名稱沒有 private. 前置字元的變數,就會發生這個錯誤。前置字串是偵錯期間的基本安全措施,可隱藏 API 代理程式追蹤和偵錯工作階段中的加密值。
診斷
1.
找出發生錯誤的鍵/值對應作業政策,以及無法設定值的變數名稱。您可以在錯誤回應的 faultstring 元素中找到這兩項資訊。舉例來說,在下列 faultstring 中,政策名稱為 EncryptedKVM,變數為 myvar:
"faultstring":"Failed to set variable myvar in KeyValueMapStepDefinition EncryptedKVM"
1.
在失敗的鍵值對應作業政策 XML 中,確認 <Get> 元素的 assignTo 屬性中指定的變數名稱,與錯誤字串中識別的變數名稱 (上述步驟 1) 相符。舉例來說,下列鍵值對應作業政策會在 <Get> 元素中指定名為 myvar 的變數,與 faultstring 中的內容相符:
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="Key-Value-Map-Operations-1" mapIdentifier="testEncrypted">
<DisplayName>KeyValueMapOperations-1</DisplayName>
<Properties/>
<ExclusiveCache>false</ExclusiveCache>
<ExpiryTimeInSecs>300</ExpiryTimeInSecs>
<Get assignTo="myvar" index="1">
<Key>
<Parameter>foo</Parameter>
</Key>
</Get>
<Scope>environment</Scope>
</KeyValueMapOperations>
檢查
mapIdentifier屬性中指定的鍵/值對應是否為加密的 KVM。如要在 Apigee 使用者介面中檢查 KVM 是否已加密,請按照下列步驟操作:
- 在 Apigee 使用者介面中,按一下左側導覽選單中的「管理」。
- 按一下「環境」。
- 按一下「鍵/值對應」。
- 找出要使用的鍵/值對應。
- 按一下名稱左側的箭頭,展開值清單。
- 如「關於加密 KVM」一文所述,加密鍵值對應表會在使用者介面中以星號遮蓋值 (*****)。
如果鍵/值對應是加密的 KVM,且
<Get>元素的assignTo屬性中使用的變數名稱沒有private前置字串。這就是錯誤原因。在上述鍵/值對應作業政策範例中,鍵/值對應
testEncrypted已加密,且變數名稱myvar沒有private前置字元。因此您會收到以下錯誤代碼:steps.keyvaluemapoperations.SetVariableFailed
解析度
如果使用的鍵/值對應表經過加密,請確保變數名稱在鍵/值對應表作業政策的 <Get> 元素中,具有 assignTo 屬性的 private. 前置字元。
如要修正上述範例的「鍵值對應作業」政策,您可以將屬性 assignTo 的值修改為 private.myvar:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="Key-Value-Map-Operations-1" mapIdentifier="testEncrypted">
<DisplayName>KeyValueMapOperations-1</DisplayName>
<Properties/>
<ExclusiveCache>false</ExclusiveCache>
<ExpiryTimeInSecs>300</ExpiryTimeInSecs>
<Get assignTo="private.myvar" index="1">
<Key>
<Parameter>foo</Parameter>
</Key>
</Get>
<Scope>environment</Scope>
</KeyValueMapOperations>