Dealing with UnknownHostException
Problem
During exports or when managing export templates the operation fails and an UnknownHostException is printed to the log:
java.lang.RuntimeException: java.net.UnknownHostException: confserv1: confserv1
at com.atlassian.security.auth.trustedapps.UIDGenerator.generateUID(UIDGenerator.java:71)
at com.k15t.scroll.confluence.util.KeyGenerator.generateKey(KeyGenerator.java:18)
at com.k15t.scroll.confluence.services.task.impl.DefaultAsynchronousTaskManager.startAsyncTask(DefaultAsynchronousTaskManager.java:48)
at com.k15t.scroll.confluence.web.rest.ExportResource.startExport(ExportResource.java:219)
...
Environment
- Unix servers
- All Scroll Exporters
- Scroll Versions
- Scroll Viewport
- All versions
Resolution
To solve the UnknownHostException:
Open the file
/etc/hosts
and check if there is a line for your public IP address containing the hostname (short version and fully qualified).
For example if your public IP address is1.2.3.4
, the Confluence server's hostname isconfserv1
and the public domain of the server isconfluence.mycompany.com
then make sure a line like this exists:CODE1.2.3.4 conserv1 confluence.mycompany.com
If there is a line like the one below please split it into two separate lines and replace the loopback IP (127.0.0.1, ::1) with the actual IP of your server:
Instead of:File: /etc/hosts (NOT compatible)
CODE127.0.0.1 localhost localhost.localdomain confserv1 confserv1.local confluence.mycompany.com
use:
CODE127.0.0.1 localhost localhost.localdomain 1.2.3.4 confserv1 confserv1.local confluence.mycompany.com
Cause
This typically happens on Unix servers where the networking is set up in a certain way that Java cannot handle correctly.