Legacy Knowledge Base
Publicado Jun. 25, 2030

Developer license can not be registered with NullPointerException and UnknownHostException

Written By

Shine Yang

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

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

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

  • Liferay DXP 7.0 

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).
Did this article resolve your issue ?

Legacy Knowledge Base