Issue
-
When a node starts in cluster mode, with the property "cluster.link.enabled" enabled, an error trace like the following appears in the log:
2021-03-22 10:20:12.856 WARN [http-nio-8080-exec-1][PortalImpl:6840] javax.servlet.ServletException: A servlet matching the filter (servlet.init.private=false)(servlet.type=friendly-url) is unavailable
javax.servlet.ServletException: A servlet matching the filter (servlet.init.private=false)(servlet.type=friendly-url) is unavailable
...
Caused by: java.lang.NullPointerException
at com.liferay.staging.security.internal.permission.StagingPermissionChecker.hasPermission(StagingPermissionChecker.java:128)
...
2021-03-22 10:20:12.975 ERROR [http-nio-8080-exec-1][error_jsp:618] User ID null
2021-03-22 10:20:12.975 ERROR [http-nio-8080-exec-1][error_jsp:619] Current URL /
2021-03-22 10:20:12.975 ERROR [http-nio-8080-exec-1][error_jsp:620] Referer null
2021-03-22 10:20:12.976 ERROR [http-nio-8080-exec-1][error_jsp:621] Remote address 127.0.0.1
2021-03-22 10:20:12.976 ERROR [http-nio-8080-exec-1][error_jsp:623] com.liferay.portal.kernel.events.ActionException: java.lang.NullPointerException
com.liferay.portal.kernel.events.ActionException: java.lang.NullPointerException
...
Caused by: java.lang.NullPointerException
at com.liferay.staging.security.internal.permission.StagingPermissionChecker.hasPermission(StagingPermissionChecker.java:128)
- Disabling the cluster mode, with the property "cluster.link.enabled" disabled, the node starts without any problem.
- This error is related to the outgoing IP and the network interface used for the cluster communication.
-
JGroups, by default, sets a bind address automatically using localhost. However, in some configurations, localhost is bound to the internal loopback network (127.0.0.1 or:1), rather than the host’s real address.
-
To overwrite this behavior, Liferay has the property "cluster.link.autodetect.address". The interface selected will be one that can resolve the address specified in this property (by default www.google.com:80). If this address is not reachable, localhost will be used and the exception can appear.
Environment
- Liferay DXP 7.2+
Resolution
- One way to resolve this problem is to change the value of the property "cluster.link.autodetect.address" in the portal-ext.properties to have a host/port combination that is reachable by the cluster link and that it can be used to set up itself. The easiest option is to use the database server and port that we already know (and can access) and use that to replace the default value.
-
Example:
cluster.link.autodetect.address=database_node:1521
Additional Information
- Enabling Cluster Link
- Configuring a Liferay cluster (and make it use unicast) (Liferay Community blog post)