Address Already in Use Exception After Enabling TLS in Jetty

 

Problem

Datameer service doesn't start and the following messages appear:

conductor.log

[DatameerShutdownHook] (DatameerShutdownHook.java:19) - Received shutdown signal!

stderrout.log

2017-12-13 13:14:52.790:INFO:oejs.ServerConnector:main: Started ServerConnector@18cc227c{HTTP/1.1}{0.0.0.0:8443} 2017-12-13 13:14:52.790:WARN:oejuc.AbstractLifeCycle:main: FAILED ServerConnector@192e845f{SSL-http/1.1}{0.0.0.0:8443}: java.net.BindException: Address already in use java.net.BindException: Address already in use.j

 

Most likely, the reason for this problem is a Datameer/Jetty misconfiguration. 

 

Solution

 
System validation:
  • Log in as privileged user (root).
  • Check if there are any Datameer or Jetty processes running via ps -ef | grep jetty and ps -ef | grep datameer.
  • If there are, kill them.
  • Check for any service already listening at ports 8080 or 8443 via lsof -i:8080  and lsof -i:8443.
  • As soon as you ensure that no Datameer/Jetty processes are running and no services are occupying ports 8080 and 8443, login as the Datameer user and try to start the application again.

 

If you still get the same error message, please ensure that:

  • ssl and https modules are added into the Jetty config.
    java -jar start.jar --list-config | grep-i 'etc/jetty*'
  • http module is excluded from Jetty config (simply comment or remove related lines at /Datameer installation folder/start.ini file).
  • the export DAS_PORT property in /Datameer installation folder/etc/das-env.sh file is uncommented and set to correct port you use for TLS.
 
After all above settings are in place, start Datameer. 
 
Note! Instead of disabling the http module in Jetty, you could redirect all requests from http to https as described in the article How to Redirect HTTP to HTTPS in Jetty 9.