您正在查看 Apigee 和 Apigee Hybrid 說明文件。
查看
Apigee Edge 說明文件。
InvalidIndex
錯誤訊息
透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:
Error Saving Revision revision_number Invalid index index in KeyValueMapStepDefinition policy_name.
錯誤訊息範例
Error Saving Revision 2
Invalid index 0 in KeyValueMapStepDefinition GetKVM.
錯誤螢幕截圖範例
原因
如果 Key Value Map Operations 政策的 <Get>
元素中指定的 index
屬性為零或負數,則 API 代理程式會部署失敗。索引會從 1
開始,因此索引為零或負整數會視為無效。
舉例來說,如果在「Key Value Map Operations」政策的 <Get>
元素中指定的 index
為 0
,則 API 代理程式會部署失敗。
診斷
找出發生錯誤的鍵/值對應作業政策和無效的索引。您可以在錯誤訊息中找到這項資訊。舉例來說,在下列錯誤中,政策名稱為
GetKVM
,無效的索引為0
:Invalid index 0 in KeyValueMapStepDefinition GetKVM.
請確認失敗的 Key-Value 對應作業政策
<Get>
元素中指定的索引值,與錯誤訊息中指出的值相符 (請參閱上述步驟 1)。舉例來說,下列政策會將索引的值指定為0
,與錯誤訊息中的值相符:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <KeyValueMapOperations mapIdentifier="FooKVM" async="false" continueOnError="false" enabled="true" name="GetKVM"> <DisplayName>GetKVM</DisplayName> <ExpiryTimeInSecs>86400</ExpiryTimeInSecs> <Scope>environment</Scope> <Get assignTo="foo_variable" index="0"> <Key> <Parameter>FooKey_1</Parameter> </Key> </Get> </KeyValueMapOperations>
如果指定的索引為零或負整數,則是錯誤的原因。
在上述範例的鍵值對應作業政策中,索引值為
0
,此值無效。因此,API Proxy 的部署作業會失敗,並顯示以下錯誤:Invalid index 0 in KeyValueMapStepDefinition GetKVM.
解決方法
請確認 Key Value Map Operations 政策的 <Get>
元素中指定的索引屬性有效 (非零或負整數)。
如要修正上述範例的值對應作業政策,您可以將索引修改為 1
。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations mapIdentifier="FooKVM" async="false" continueOnError="false" enabled="true" name="GetKVM">
<DisplayName>GetKVM</DisplayName>
<ExpiryTimeInSecs>86400</ExpiryTimeInSecs>
<Scope>environment</Scope>
<Get assignTo="foo_variable" index="1">
<Key>
<Parameter>FooKey_1</Parameter>
</Key>
</Get>
</KeyValueMapOperations>
KeyIsMissing
錯誤訊息
透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:
Error Saving Revision revision_number Error occurred while validation of bean policy_name.xml Reason: - Non null value expected for element Parameter in Entry.
錯誤訊息範例
Error Saving Revision 3
Error occurred while validation of bean GetKVM.xml. Reason: - Non null value expected for element Parameter in Entry
錯誤螢幕截圖範例
原因
如果 <Key>
元素完全缺少,或是 <Parameter>
元素缺少 <Key>
元素 (位於 Key-Value Map Operations 政策的 <InitialEntries>
元素 <Entry>
下方),就會發生這個錯誤。
診斷
找出發生錯誤的「鍵/值對應作業」政策。您可以在錯誤訊息中找到這項資訊。例如,在下列錯誤中,Key Value Map Operations 政策的名稱為
GetKVM
。Error occurred while validation of bean GetKVM.xml. Reason: - Non null value expected for element Parameter in Entry
在失敗的鍵值對應作業政策中,請檢查是否有任何
<Entry>
元素在<InitialEntries>
下方缺少<Key>
或<Parameter>
元素。以下是範例鍵/值對應作業政策,其中
<Key>
元素中缺少<Parameter>
元素:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="GetKVM" mapIdentifier="FooKVM"> <DisplayName>GetKVM</DisplayName> <Properties/> <ExclusiveCache>false</ExclusiveCache> <ExpiryTimeInSecs>300</ExpiryTimeInSecs> <InitialEntries> <Entry> <Key/> <Value>v1</Value> </Entry> <Entry> <Key> <Parameter>k2</Parameter> </Key> <Value>v2</Value> </Entry> </InitialEntries>
在這種情況下,第一個元素會導致問題。
解決方法
請確認「鍵/值對應作業」政策中 <InitialEntries>
元素下方的所有 <Entry>
元素都包含 <Key>
元素,後面接著 <Parameter>
元素。
如要修正上述的 Key-Value 對應運算政策範例,只要新增 <Parameter>
元素即可解決問題:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="GetKVM" mapIdentifier="FooKVM">
<DisplayName>GetKVM</DisplayName>
<Properties/>
<ExclusiveCache>false</ExclusiveCache>
<ExpiryTimeInSecs>300</ExpiryTimeInSecs>
<InitialEntries>
<Entry>
<Key>
<Parameter>k1</Parameter>
</Key>
<Value>v1</Value>
</Entry>
<Entry>
<Key>
<Parameter>k2</Parameter>
</Key>
<Value>v2</Value>
</Entry>
</InitialEntries>
...
ValueIsMissing
錯誤訊息
透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:
Error Saving Revision revision_number Error occurred while validation of bean policy_name.xml. Reason: - Non null value expected for element Value in Entry.
錯誤訊息範例
Error Saving Revision 3
Error occurred while validation of bean GetKVM.xml.Reason: - Non null value expected for element Value in Entry
錯誤螢幕截圖範例
原因
如果 Key Value Map Operations 政策的 <InitialEntries>
元素 <Entry>
元素下方缺少 <Value>
元素,就會發生此錯誤。
診斷
找出發生錯誤的「鍵/值對應作業」政策。您可以在錯誤訊息中找到這項資訊。例如,在下列錯誤中,Key Value Map Operations 政策的名稱為
GetKVM
。Error occurred while validation of bean GetKVM.xml. Reason: - Non null value expected for element Value in Entry
在失敗的鍵值對應作業政策中,請檢查是否有任何
<Entry>
元素在<InitialEntries>
下方缺少<Value>
元素。以下是缺少
<Value>
元素的 Key Value Map Operations 政策範例:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="GetKVM" mapIdentifier="testNotEncrypte"> <DisplayName>GetKVM3</DisplayName> <Properties/> <ExclusiveCache>false</ExclusiveCache> <ExpiryTimeInSecs>300</ExpiryTimeInSecs> <InitialEntries> <Entry> <Key> <Parameter>k1</Parameter> </Key> </Entry> <Entry> <Key> <Parameter>k2</Parameter> </Key> <Value>v2</Value> </Entry> </InitialEntries> ...
解決方法
請確認「鍵/值對應作業」政策中 <InitialEntries>
元素下方的所有 <Entry>
元素都有 <Value>
元素。
如要修正上述的 Key-Value 對應運算政策範例,只要新增 <Value>
元素即可解決問題:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="GetKVM" mapIdentifier="testNotEncrypte">
<DisplayName>GetKVM3</DisplayName>
<Properties/>
<ExclusiveCache>false</ExclusiveCache>
<ExpiryTimeInSecs>300</ExpiryTimeInSecs>
<InitialEntries>
<Entry>
<Key>
<Parameter>k1</Parameter>
</Key>
<Value>v1</Value>
</Entry>
<Entry>
<Key>
<Parameter>k2</Parameter>
</Key>
<Value>v2</Value>
</Entry>
</InitialEntries>
...