Issue
- After configuring the cluster using DNS_PING we obtain below stacktrace and the cluster doesn't start:
com.liferay.portal.kernel.exception.SystemException: Unable to create JGroupsClusterChannel
at com.liferay.portal.cluster.multiple.internal.jgroups.JGroupsClusterChannelFactory.createClusterChannel(JGroupsClusterChannelFactory.java:75) ~[?:?]
at com.liferay.portal.cluster.multiple.internal.ClusterExecutorImpl.initialize(ClusterExecutorImpl.java:391) ~[?:?]
at com.liferay.portal.cluster.multiple.internal.ClusterExecutorImpl.activate(ClusterExecutorImpl.java:199) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:228) ~[bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664) ~[bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510) [bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:310) [bundleFile:?]
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:300) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:341) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:114) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:983) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:956) [bundleFile:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:901) [bundleFile:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212) [org.eclipse.osgi.jar:?]
...
Caused by: com.liferay.portal.kernel.exception.SystemException: Unable to initial cluster channel liferay-channel-control
at com.liferay.portal.cluster.multiple.internal.jgroups.JGroupsClusterChannel.<init>(JGroupsClusterChannel.java:103) ~[?:?]
at com.liferay.portal.cluster.multiple.internal.jgroups.JGroupsClusterChannelFactory.createClusterChannel(JGroupsClusterChannelFactory.java:70) ~[?:?]
... 138 more
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.jndi.dns.DnsContextFactory
at javax.naming.spi.NamingManager.getFactory(NamingManager.java:760) ~[?:?]
at javax.naming.spi.NamingManager.lambda$getInitialContext$1(NamingManager.java:722) ~[?:?]
...
Caused by: java.lang.IllegalAccessException: class javax.naming.spi.NamingManager (in module java.naming) cannot access class com.sun.jndi.dns.DnsContextFactory (in module jdk.naming.dns) because module jdk.naming.dns does not export com.sun.jndi.dns to module java.naming
at jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361) ~[?:?]
at jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:99) ~[?:?]
Environment
- Liferay DXP 7.4
Resolution
- Adding
--add-exports jdk.naming.dns/com.sun.jndi.dns=java.namingto jvm environment variables in setenv.sh solves the issue.