Error message
When you call the High-speed Service Framework (HSF) service, an exception occurs when you obtain userId based on the configured route parameter. The following error message is reported:
java.lang.IllegalArgumentException: invalid route while WriteMode=unit, route : -1
Solution
This error occurs when the parameter position specified by route is invalid. The unitized attribute route indicates the subscript of userId in a parameter array and must be set to a non-negative integer. The value of route cannot be greater than the number of the parameters in the parameter array of a method. The default value is 0. The value 0 indicates that the userId parameter is at the first position in the parameter array.
The following code block provides a sample configuration.
<bean id="helloWorldServiceProvider"
init-method="init">
<property name="serviceInterface">
<value>com.taobao.hsf.jar.test.HelloWorldService</value>
</property>
<property name="target">
<ref bean="helloWorldServiceImpl" />
</property>
<property name="serviceVersion">
<value>1.0.zhouli</value>
</property>
<property name="writeMode">
<value>center</value>
</property>
<property name="route">
<value>0</value>
</property>
</bean>