Quota Policy - Throws NullPointerException

I have a simple quota policy in my proxy which throws the NullPointerException as shown below:

{ "fault": { "faultstring": "NullPointerException", "detail": { "errorcode": "Internal Server Error" } } } 

This error is thrown only when I have a KeyValueMapOperations policy before the Quota policy. If I remove the KVMAP then the problem goes away.

The KVMAP policy contents are as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="KeyValueMapOperations" mapIdentifier="mykvmap">
    <Scope>environment</Scope>
    <Get assignTo="ratelimit" index="1">
        <Key>
            <Parameter>ratelimit</Parameter>
        </Key>
    </Get>
    <Get assignTo="log_level" index="1">
        <Key>
            <Parameter>log_level</Parameter>
        </Key>
    </Get>
</KeyValueMapOperations>

Can you please let me know why this issue occurs only when I have this KVMAP ?

Solved Solved
2 4 2,316
1 ACCEPTED SOLUTION

Not applicable

The KVM policy has a key named “ratelimit” which is also used internally by the rate limit code to retrieve rate limit policy details.

This results in a namespace conflict between the two and we see a NPE.

This is applicable to an AssignMessage policy as well.

<AssignVariable>

<Name>ratelimit</Name>

<Ref/>

</AssignVariable>

Changing the key name would help.

View solution in original post

4 REPLIES 4

Not applicable

The KVM policy has a key named “ratelimit” which is also used internally by the rate limit code to retrieve rate limit policy details.

This results in a namespace conflict between the two and we see a NPE.

This is applicable to an AssignMessage policy as well.

<AssignVariable>

<Name>ratelimit</Name>

<Ref/>

</AssignVariable>

Changing the key name would help.

@krupa

Thanks for your response.

I changed the "ratelimit" to "rate_limit" and the problem disappeared.

Thanks for the post and the answer. I've updated the KVM policy and AssignMessage policy (AssignVariable name) docs to say that "ratelimit" is a reserved word.

@Floyd Jones

Many Thanks for updating the docs with this information.