查看 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.
前置字元的變數,就會發生這個錯誤。
前置字串,這是偵錯期間基本安全性用途的必要項目,可隱藏
並對工作階段偵錯。
診斷
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 已在環境範圍加密,您可以確認 KVM 是否已加密。 設定。否則,如果是在機構或 apiproxy 範圍內建立,則必須使用 Management API 驗證是否已加密。另請參閱管理及使用 KVM。如何在 Edge UI 中檢查範圍限定的 KVM 是否已加密:
- 在 Edge UI 中,按一下左側導覽選單中的「管理」。
- 按一下「環境」。
- 按一下「鍵/值對應」。
- 找出要使用的鍵/值對應。
- 按一下名稱左側的箭頭,即可展開值清單。
- 「已加密的鍵/值對應」會顯示 UI 中以星號遮蔽的值 (*****),如關於加密的 KVM 所述。
如要檢查機構、環境或 APIProxy 層級的 KVM 是否已加密,請使用 Management API。如果您使用 API,則回應範例會同時顯示加密設定和星號值,如下所示:
{ "encrypted": true, "entry": [ { "name": "foo", "value": "*****" } ], "name": "encrypted" }
如果鍵/值對應是加密的 KVM 和
<Get>
元素的assignTo
屬性不含前置字串private
。 這就是發生錯誤的原因。在上方顯示的鍵/值對應作業政策範例中,鍵/值對應
testEncrypted
已加密,變數名稱myvar
則不含前置字串private
。因此,您會收到以下錯誤代碼:steps.keyvaluemapoperations.SetVariableFailed
解析度
確認變數名稱在 assignTo
屬性中具有 private.
前置字串
索引鍵值對應作業政策的 <Get>
元素
都會經過加密
如要修正上述範例的鍵值對應作業政策,您可以將屬性 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>