Issue
- When deploying a developer license, the DXP instance can not be activated with
NullPointerException
and UnknownHostException
2023-05-15 05:35:37.524 ERROR [fileinstall-/home/username/liferay-dxp-digital-enterprise-7.0.10-de-98/osgi/modules][LicenseManager:?] DXP Development license validation failed
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:461)
at com.liferay.portal.license.LicenseManager.f(Unknown Source)
at com.liferay.portal.license.LicenseManager.getServerId(Unknown Source)
at com.liferay.portal.license.LicenseManager.c(Unknown Source)
at com.liferay.portal.license.LicenseManager.checkBinaryLicense(Unknown Source)
at com.liferay.portal.license.LicenseManager.registerLicense(Unknown Source)
at com.liferay.portal.license.util.LocalLicenseManagerImpl.registerLicense(LocalLicenseManagerImpl.java:82)
at com.liferay.portal.kernel.license.util.LicenseManagerUtil.registerLicense(LicenseManagerUtil.java:79)
at com.liferay.portal.license.deployer.internal.installer.LicenseInstaller.install(LicenseInstaller.java:71)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:937)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:871)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:485)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
2023-05-15 06:25:06.734 INFO [fileinstall-/home/username/liferay-dxp-digital-enterprise-7.0.10-de-98/osgi/modules][LicenseManager:?] License registered for DXP Development)
2023-05-15 06:24:52.079 ERROR [Start Level: Equinox Container: a0205a0f-e9f2-001d-1733-dbe89e521793][Cache:224] Unable to set localhost. This prevents creation of a GUID. Cause was: hostname: hostname: Name or service not known
java.net.UnknownHostException: hostname: hostname: Name or service not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1512)
at net.sf.ehcache.Cache.<clinit>(Cache.java:222)
at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:305)
at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:223)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:788)
at net.sf.ehcache.CacheManager.doInit(CacheManager.java:474)
at net.sf.ehcache.CacheManager.init(CacheManager.java:398)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:269)
at com.liferay.portal.cache.ehcache.internal.EhcachePortalCacheManager.initPortalCacheManager(EhcachePortalCacheManager.java:253)
at com.liferay.portal.cache.BasePortalCacheManager.initialize(BasePortalCacheManager.java:236)
at com.liferay.portal.cache.ehcache.internal.MultiVMEhcachePortalCacheManager.activate(MultiVMEhcachePortalCacheManager.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...
Caused by: java.net.UnknownHostException: hostname: Name or service not known
at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1330)
at java.net.InetAddress.getLocalHost(InetAddress.java:1507)
... 238 more
Environment
Resolution
- The error is due to the network configuration on the OS level. More specifically, the hostname does not resolve into any known IP address. The OS is unable to get the corresponding IP address. This makes the
UnknownHostException
to be thrown when getting the localhost
. The logic happens in several places, one of them being the license validation code.
- To resolve this, check the
/etc/hosts
file and make sure that the following line exists:
127.0.1.1 hostname
Note: Replace hostname
to the real hostname
of your OS (output of hostname
command).
订阅者专属内容
Liferay企业级订阅提供超过1500篇文章的访问权限,包括最佳范例,排查和解决问题,和其他有价值的解决方案。登录以获得全部权限。
登录