您目前查看的是 Apigee 和 Apigee Hybrid 說明文件。
查看
Apigee Edge 說明文件。
InvalidIndex
錯誤訊息
透過 Apigee 使用者介面或 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 Proxy 的部署作業就會失敗。索引從 1 開始,因此零或負整數的索引視為無效。
舉例來說,如果指定的 index 是 Key Value Map Operations 政策 <Get> 元素中的 0,API Proxy 的部署作業就會失敗。
診斷
找出發生錯誤的鍵/值對應作業政策和無效索引。這項資訊會顯示在錯誤訊息中。舉例來說,在下列錯誤中,政策名稱為
GetKVM,無效的索引為0:Invalid index 0 in KeyValueMapStepDefinition GetKVM.確認失敗的「鍵值對應作業」政策的
<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.
解析度
確認鍵/值對應作業政策的 <Get> 元素中指定的索引屬性有效 (非零或負整數)。
如要修正上述範例中的 Key Value Map Operations 政策,您可以將索引修改為 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 使用者介面或 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> 元素,或在鍵值對應作業政策的 <InitialEntries> 元素 <Entry> 下,缺少 <Key> 元素內的 <Parameter> 元素,就會發生這個錯誤。
診斷
找出發生錯誤的鍵/值對應作業政策。這項資訊會顯示在錯誤訊息中。舉例來說,在下列錯誤中,鍵值對應作業政策的名稱為
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> 元素。
如要修正上述範例的「鍵/值對應作業」政策,請新增 <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 使用者介面或 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> 元素,就會發生這個錯誤。
診斷
找出發生錯誤的鍵/值對應作業政策。這項資訊會顯示在錯誤訊息中。舉例來說,在下列錯誤中,鍵值對應作業政策的名稱為
GetKVM。Error occurred while validation of bean GetKVM.xml. Reason: - Non null value expected for element Value in Entry在失敗的鍵值對應作業政策中,檢查是否有任何
<Entry>元素缺少<InitialEntries>底下的<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> </Entry> <Entry> <Key> <Parameter>k2</Parameter> </Key> <Value>v2</Value> </Entry> </InitialEntries> ...
解析度
確認鍵/值對應作業政策中 <InitialEntries> 元素底下的所有 <Entry> 元素都有 <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>
...