When connecting through a web server to a Worklight server running in the Liberty profile, problems can occur due to the lack of a clone ID being configured in Liberty.
When connecting through a web server to the Worklight server from an app on a mobile device or emulator, repeated 401 errors are returned from the server and the app does not complete its initialization. Or if logging in to the Worklight console through the web server, the following error will occur:
java.lang.IllegalArgumentException: Location cannot be null in javax.servlet.http.HttpServletResponse.sendRedirect(location).
This problem is caused by the cloneId attribute not being set in the server.xml file for the Liberty server. When the plugin-cfg.xml file is generated, a clone ID is included in the file that matches an ID that is generated by the server at run time. When the Liberty server is restarted, a new clone ID is generated that does not match the one in the file. This leads to the behavior that is described above.
Resolving the problem
To avoid this behavior, the CloneID property can be removed from the plugin-cfg.xml file, or the cloneId property can be added to the server.xml file, followed by a re-generation of the plugin file as described in the following steps:
- add the cloneId attribute to the server.xml file. This will be part of an httpSession element. For example: <httpSession cloneId="clone1"/>
- restart the Liberty server.
- generate a new plugin-cfg.xml file. Verify that the CloneID is set to the value defined in the server.xml file.
- also verify that the IgnoreAffinityRequests attribute is set to false. Affinity is required for Worklight when multiple servers are used.