Error message
java.lang.IllegalArgumentException: invalid route while WriteMode=unit, route : -1This error occurs during a High-speed Service Framework (HSF) service call when HSF cannot resolve userId from the method parameters based on the configured route value.
Possible causes
The route attribute specifies the index position of the userId parameter in a method's parameter array. HSF throws this error when route has an invalid value:
| Constraint | Description |
|---|---|
| Non-negative integer | route must be 0 or a positive integer. Negative values such as -1 are invalid. |
| Within parameter bounds | route must not exceed the total number of parameters in the method's parameter array. |
The default value of route is 0, which points to the first parameter in the array.
Troubleshooting steps
Open your HSF service provider bean configuration.
Locate the
routeproperty.Verify that
routeis set to a non-negative integer that does not exceed the number of parameters in the target method.If
routeis not specified, HSF uses the default value0. Confirm that the first parameter in the method isuserId.
Example configuration
The following Spring bean configuration sets route to 0, which means userId is the first parameter in the method's parameter array:
<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>| Property | Description |
|---|---|
serviceInterface | The Java interface for the HSF service provider. |
target | A reference to the service implementation bean. |
serviceVersion | The version of the HSF service. |
writeMode | The write mode for unitized deployment. |
route | The index of userId in the method's parameter array. Default: 0. |