您正在查看 Apigee Edge 說明文件。
查看 Apigee X 說明文件。 資訊
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>apiproxy</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>apiproxy</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 Proxy 追蹤和偵錯工作階段中隱藏加密的值。
診斷
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。如果 KVM 在環境範圍內經過加密,您可以在 Edge UI 中確認 KVM 是否已經過加密。否則,如果是在機構或 apiproxy 範圍中建立的,都必須使用 Management API 來驗證是否已加密。另請參閱管理及使用 KVM。如何在 Edge UI 中檢查環境範圍 KVM 是否已加密:
- 在 Edge UI 中,按一下左側導覽選單中的「Admin」(管理)。
- 按一下「環境」。
- 按一下「鍵/值對應」。
- 找出要使用的鍵/值對應。
- 按一下名稱左側的箭頭,即可展開值清單。
- 「已加密的金鑰值對應」在使用者介面中會以星號 (*****) 顯示遮蓋的值,如關於加密的 KVM 所示。
如要查看範圍限定在機構、環境或 APIproxy 層級的 KVM 是否已加密,請使用 Management API。如果您使用 API,則範例回應會同時顯示該值的加密設定和星號,如下所示:
{ "encrypted": true, "entry": [ { "name": "foo", "value": "*****" } ], "name": "encrypted" }
如果鍵/值對應是經過加密的 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>