Confluence logs errors: 'This prevents creation of a GUID' due to incorrect host name
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
The following error appears in the atlassian-confluence.log
:
2011-03-16 18:20:03,021 ERROR [main] [net.sf.ehcache.Cache] <clinit> Unable to set localhost. This prevents creation of a GUID. Cause was: <hostname>: <hostname>
java.net.UnknownHostException: <hostname>: <hostname>
at java.net.InetAddress.getLocalHost(InetAddress.java:1354)
at net.sf.ehcache.Cache.<clinit>(Cache.java:145)
Or appears as an APPARENT DEADLOCK with java.net.InetAddress.getLocalHost
in the stack trace:
2020-04-23 13:06:05,467 WARN [C3P0PooledConnectionPoolManager[identityToken->2w3zt6a91asfohs45mi33|4e5cee73]-AdminTaskTimer] [mchange.v2.async.ThreadPoolAsynchronousRunner] log com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@75da8a7e -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2020-04-23 13:06:05,471 WARN [C3P0PooledConnectionPoolManager[identityToken->2w3zt6a91asfohs45mi33|4e5cee73]-AdminTaskTimer] [mchange.v2.async.ThreadPoolAsynchronousRunner] log com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@75da8a7e -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@381fa96e
on thread: C3P0PooledConnectionPoolManager[identityToken->2w3zt6a91asfohs45mi33|4e5cee73]-HelperThread-#1
...
Pool thread stack traces:
Thread[C3P0PooledConnectionPoolManager[identityToken->2w3zt6a91asfohs45mi33|4e5cee73]-HelperThread-#0,1,main]
java.net.InetAddress.getLocalHost(InetAddress.java:1487)
com.microsoft.sqlserver.jdbc.Util.lookupHostName(Util.java:665)
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2211)
com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1897)
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1738)
com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1062)
com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:572)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
...
Thread[C3P0PooledConnectionPoolManager[identityToken->2w3zt6a91asfohs45mi33|4e5cee73]-HelperThread-#1,1,main]
java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
java.net.InetAddress.getLocalHost(InetAddress.java:1501)
com.microsoft.sqlserver.jdbc.Util.lookupHostName(Util.java:665)
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2211)
com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1897)
Cause
The local hostname (or COMPUTERNAME - Windows) that is running Confluence is not in the host file or is not resolvable via DNS lookup.
Resolution
Linux:
- Run hostname on the machine running Confluence
- Edit
/etc/hosts
and add the following line:
127.0.0.1 <output of hostname>
Windows:
Open a command prompt and run ipconfig /all
Locate the "Host Name" line and the hostname will be on the right
Navigate to:
C:\Windows\System32\drivers\etc\
Edit the hosts file in a text editor of your choice as an administrator
Add the following line:
127.0.0.1 <Host Name value>
We strongly recommend placing the hostname in the hosts file as a fail-safe for DNS server failure.
Alternatively, make the hostname resolvable via DNS.