<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Alfresco 5.1 Admin Console Not Displaying Hostname in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84776#M25806</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Simple question, we have two nodes, and in the Alfresco Admin Console, at the very top, there is a field that displays the hostname and IP. &amp;nbsp;I would like that to display the actual hostname and IP of the node &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &amp;nbsp;This helps us identify which node we are in for testing etc., &amp;nbsp;Any suggestions? &amp;nbsp;The hostname/IP is set in /etc/hosts on the machines, and issuing a 'hostname' command from the terminal returns the correct hostname.&lt;/P&gt;&lt;P&gt;Pic below:&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/a/2EJK9y5" target="_blank" rel="noopener nofollow noreferrer"&gt;https://imgur.com/a/2EJK9y5&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2019 15:21:26 GMT</pubDate>
    <dc:creator>waywitka</dc:creator>
    <dc:date>2019-09-19T15:21:26Z</dc:date>
    <item>
      <title>Alfresco 5.1 Admin Console Not Displaying Hostname</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84776#M25806</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Simple question, we have two nodes, and in the Alfresco Admin Console, at the very top, there is a field that displays the hostname and IP. &amp;nbsp;I would like that to display the actual hostname and IP of the node &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &amp;nbsp;This helps us identify which node we are in for testing etc., &amp;nbsp;Any suggestions? &amp;nbsp;The hostname/IP is set in /etc/hosts on the machines, and issuing a 'hostname' command from the terminal returns the correct hostname.&lt;/P&gt;&lt;P&gt;Pic below:&lt;/P&gt;&lt;P&gt;&lt;A href="https://imgur.com/a/2EJK9y5" target="_blank" rel="noopener nofollow noreferrer"&gt;https://imgur.com/a/2EJK9y5&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 15:21:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84776#M25806</guid>
      <dc:creator>waywitka</dc:creator>
      <dc:date>2019-09-19T15:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco 5.1 Admin Console Not Displaying Hostname</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84777#M25807</link>
      <description>&lt;P&gt;&amp;nbsp;Did you try to set alfresco.host variable in alfresco-global.properties ?&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;P&gt;--C&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 18:08:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84777#M25807</guid>
      <dc:creator>cesarista</dc:creator>
      <dc:date>2019-09-19T18:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco 5.1 Admin Console Not Displaying Hostname</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84778#M25808</link>
      <description>&lt;P&gt;When admin console page is loaded, it extracts the host and ip using utility script. This 'admin-systemsummary.get.html.ftl' loads the admin screen, it includes a js file 'admin-common.lib.js'. This js calls the util script. This is the class which facilitates the util script:&amp;nbsp;&lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/java/org/alfresco/web/scripts/WebScriptUtils.java" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/java/org/alfresco/web/scripts/WebScriptUtils.java&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If you open this java class, you will notice that it is using&amp;nbsp;&lt;SPAN class="pl-smi"&gt;InetAddress&lt;/SPAN&gt;&lt;SPAN class="pl-k"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getLocalHost()&lt;/SPAN&gt;&lt;SPAN class="pl-k"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getHostAddress(); and&amp;nbsp;&lt;SPAN class="pl-smi"&gt;InetAddress&lt;/SPAN&gt;&lt;SPAN class="pl-k"&gt;.&lt;/SPAN&gt;getLocalHost()&lt;SPAN class="pl-k"&gt;.&lt;/SPAN&gt;getHostName(); to get the details. Ideally these two methods gets the correct information.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Try running these methods as a standalone program on your instance and see if it returns the correct details. InetAddress is however ambigous on linux machines.&amp;nbsp;Linux systems enumerate the loopback network interface the same way as regular LAN network interfaces, but the JDK InetAddress.getLocalHost method does not specify the algorithm used to select the address returned under such circumstances, and will often return the loopback address, which is not valid for network communication.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Refer here for more details:&amp;nbsp;&lt;A href="https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4665037" target="_blank" rel="nofollow noopener noreferrer"&gt;https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4665037&lt;/A&gt;&amp;nbsp;and you can follow the workaround. Or y&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;ou can try extending the unitilty/admin system summary component and try to use&amp;nbsp;'java.net.NetworkInterface' API for getting the hostname and ip.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 18:59:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84778#M25808</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2019-09-19T18:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco 5.1 Admin Console Not Displaying Hostname</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84779#M25809</link>
      <description>&lt;P&gt;The alfresco.host property is only ever used for generating URLs in emails and other utilities using the SysAdminParams utility. It is meant to provide only the "publicly accessible" name of the system, and may therefor be set to the DNS name of a proxy / load balancer, and not reflect the actual, technical hostname.&lt;/P&gt;
&lt;P&gt;Edit: This was meant as a reply to the response of &lt;SPAN class="UserName lia-user-name lia-user-rank-Advanced lia-component-message-view-widget-author-username"&gt;&lt;A id="link_12" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://hub.alfresco.com/t5/user/viewprofilepage/user-id/52951" target="_self" rel="nofollow noopener noreferrer"&gt;&lt;SPAN class=""&gt;cesarista&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;, but it appears that the new platform does not show any sub-threads / relations between replies in the main thread view (only when actually editing the reply again do I see the relation).&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 19:17:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84779#M25809</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2019-09-19T19:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco 5.1 Admin Console Not Displaying Hostname</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84780#M25810</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You may need to change the hostname of your Linux box. Refer this link&amp;nbsp;&lt;A href="https://geekflare.com/how-to-change-hostname-in-linux/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://geekflare.com/how-to-change-hostname-in-linux/&lt;/A&gt;&amp;nbsp;or &lt;A href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html&lt;/A&gt;&amp;nbsp;for reference.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Deepak&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 03:22:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84780#M25810</guid>
      <dc:creator>deepak1987</dc:creator>
      <dc:date>2019-09-20T03:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco 5.1 Admin Console Not Displaying Hostname</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84781#M25811</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/16045"&gt;@afaust&lt;/A&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;The alfresco.host property is only ever used for generating URLs in emails and other utilities using the SysAdminParams utility. It is meant to provide only the "publicly accessible" name of the system, and may therefor be set to the DNS name of a proxy / load balancer, and not reflect the actual, technical hostname.&lt;/P&gt;&lt;P&gt;Edit: This was meant as a reply to the response of &lt;SPAN class="UserName lia-user-name lia-user-rank-Advanced lia-component-message-view-widget-author-username"&gt;&lt;A href="https://hub.alfresco.com/t5/user/viewprofilepage/user-id/52951" target="_self" rel="nofollow noopener noreferrer"&gt;&lt;SPAN class=""&gt;cesarista&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;, but it appears that the new platform does not show any sub-threads / relations between replies in the main thread view (only when actually editing the reply again do I see the relation).&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Correct. I think I was too anxious to test the new platform.&lt;/P&gt;&lt;P&gt;Thanks for the explanation Axel.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;--C.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 05:39:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84781#M25811</guid>
      <dc:creator>cesarista</dc:creator>
      <dc:date>2019-09-20T05:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco 5.1 Admin Console Not Displaying Hostname</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84782#M25812</link>
      <description>&lt;P&gt;As far as in know this are the values configured in alfresco-global.properties.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 06:10:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84782#M25812</guid>
      <dc:creator>krutik_jayswal</dc:creator>
      <dc:date>2019-09-20T06:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco 5.1 Admin Console Not Displaying Hostname</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84783#M25813</link>
      <description>&lt;P&gt;We talked about this class in the above response:&amp;nbsp;&lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/java/org/alfresco/web/scripts/WebScriptUtils.java" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/java/org/alfresco/web/scripts/WebScriptUtils.java&lt;/A&gt; --- It is the utilty class which is facilitating the valiue of host name and IP address in admin console admin summary page.&lt;/P&gt;
&lt;P&gt;I also mentioned about the ambigous&amp;nbsp;InetAddress.getLocalHost.getHostName() and InetAddress.getLocalHost().getHostAddress(). Updating the host file did not work in some complex network setups. It is not working in your case as well as you mentioned.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So to test this case, i updated the utility (which is used by admin summary page to get the host and ip) to use network interface api and scan the NIC to find most appropriate IP address.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is what i did to make it work:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1- Extend the class&amp;nbsp;WebScriptUtils:&lt;/P&gt;
&lt;PRE&gt;public class WebScriptUtilsExtension extends WebScriptUtils {

	private static final Logger LOGGER = LoggerFactory.getLogger(WebScriptUtilsExtension.class);

	public String getHostAddress() {
		try {
			LOGGER.info("getHostAddress invoked..");
			return getLocalHost().getHostAddress();
		} catch (UnknownHostException unknownHostex) {
			LOGGER.error("Exception occurred while scanning for LAN Host Address", unknownHostex);
			return "Unknown";
		}
	}

	public String getHostName() {
		try {
			LOGGER.info("getHostName invoked..");
			return getLocalHost().getHostName();
		} catch (UnknownHostException unknownHostex) {
			LOGGER.error("Exception occurred while scanning for HOSTName", unknownHostex);
			return "Unknown";
		}
	}
	
	private InetAddress getLocalHost() throws UnknownHostException {
		try {
			InetAddress nonlbAddrsCandidate = null;
			for (final Enumeration&amp;lt;NetworkInterface&amp;gt; netInterfaceEnum = NetworkInterface.getNetworkInterfaces(); 
					netInterfaceEnum.hasMoreElements();) {
				final NetworkInterface netInterface = netInterfaceEnum.nextElement();
				for (final Enumeration&amp;lt;InetAddress&amp;gt; inetAddrsEnum = netInterface.getInetAddresses(); 
						inetAddrsEnum.hasMoreElements();) {
					final InetAddress inetAddr = inetAddrsEnum.nextElement();
					if (!inetAddr.isLoopbackAddress()) {
						if (inetAddr.isSiteLocalAddress()) {
							return inetAddr;
						} else if (nonlbAddrsCandidate == null) {
							nonlbAddrsCandidate = inetAddr;
						}
					}
				}
			}
			if (nonlbAddrsCandidate != null) {
				return nonlbAddrsCandidate;
			}
			final InetAddress jdkProvidedAddress = InetAddress.getLocalHost();
			if (jdkProvidedAddress == null) {
				throw new UnknownHostException("Unexpected null value from InetAddress.getLocalHost() method!");
			}
			return jdkProvidedAddress;
		} catch (SocketException socketEx) {
			LOGGER.error("SocketException occurred while scanning for LAN Address", socketEx);
			throw prepareUnknownHostException(socketEx);
		} catch (IOException ioex) {
			LOGGER.error("IOException occurred while scanning for LAN Address", ioex);
			throw prepareUnknownHostException(ioex);
		} catch (Exception excp) {
			LOGGER.error("Exception occurred while scanning for LAN Address", excp);
			throw prepareUnknownHostException(excp);
		}
	}

	private UnknownHostException prepareUnknownHostException(final Exception excp) {
		final UnknownHostException unHostEx = new UnknownHostException("Failed to determine LAN address due to: " + excp.getMessage());
		unHostEx.initCause(excp);
		return unHostEx;
	}
}&lt;/PRE&gt;
&lt;P&gt;2- Add this bean definition for extending the above class:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;bean id="utilsScriptExtension" parent="utilsScript" class="com.github.abhinavmishra14.repo.jscript.WebScriptUtilsExtension"&amp;gt;
      &amp;lt;property name="extensionName"&amp;gt;
         &amp;lt;value&amp;gt;utils&amp;lt;/value&amp;gt;
      &amp;lt;/property&amp;gt;
      &amp;lt;property name="serviceRegistry"&amp;gt;
         &amp;lt;ref bean="ServiceRegistry" /&amp;gt;
      &amp;lt;/property&amp;gt;
      &amp;lt;property name="nodeService" ref="nodeService"/&amp;gt;
      &amp;lt;property name="repositoryContainer"&amp;gt;
         &amp;lt;ref bean="webscripts.container" /&amp;gt;
      &amp;lt;/property&amp;gt;
   &amp;lt;/bean&amp;gt;&lt;/PRE&gt;

&lt;P&gt;I have created a sample project here using sdk4:&amp;nbsp;&lt;A href="https://github.com/abhinavmishra14/about-share-and-adminconsole-extension/blob/master/README.md" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/abhinavmishra14/about-share-and-adminconsole-extension/blob/master/README.md&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can have a look at it. You can take reference from this project to make changes in your environment and see if this works for you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2019 15:11:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84783#M25813</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2019-09-22T15:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco 5.1 Admin Console Not Displaying Hostname</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84784#M25814</link>
      <description>&lt;P&gt;Thanks for the detailed response, I feel though that this seems to be overly complicated. &amp;nbsp;We have exact same version of Alfresco running in another environment and did not have to do anything to see the hostname/IP populated in the admin console.&lt;/P&gt;&lt;P&gt;The only difference would be the other system is running Ubuntu 14 and this one is Ubuntu 18. &amp;nbsp;Of course the hostname and /etc/hosts on the machine are configured properly as far as I can tell. &amp;nbsp;I'm fairly certain that the proper information appeared "out of the box" with the older system. &amp;nbsp;Both of these systems have two nodes which are clustered, if I didn't mention that earlier. &amp;nbsp;I will keep digging....&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 15:03:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/alfresco-5-1-admin-console-not-displaying-hostname/m-p/84784#M25814</guid>
      <dc:creator>waywitka</dc:creator>
      <dc:date>2019-09-23T15:03:11Z</dc:date>
    </item>
  </channel>
</rss>

