legacy-knowledge-base
公開されました Sep. 10, 2025

java.lang.IllegalAccessExceptionでクラスタを開始できません:クラスjavax.naming.spi.NamingManager

written-by

Jorge García Jiménez

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • DNS_PINGを使用してクラスタを構成した後、以下のスタックトレースが表示され、クラスタが起動しません:
    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) ~[?:?]

環境

  • Liferay DXP 7.4

解像度

  • setenv.shのjvm環境変数に、 --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming を追加すると、問題は解決する。

did-this-article-resolve-your-issue

legacy-knowledge-base