1

I am using Tomcat 8.5 and Jersey to set up REST Api. Usually it takes up to 2 minutes to startup. However after any changes to configuration, e.g. enabling CORS or adding SSL keys, loading time increases to over 4 hours and sometimes does not load at all. Is it normal? Is there any chance to reduce this time?

Project also uses OpenCV 3.4.2 and deeplearning4j. It is deployed on Google Cloud with machine type: n1-standard-4 (4 vCPUs, 15 GB memory) on Ubuntu 18.04 64bit.

I startup Tomcat via command:

$ sudo /opt/tomcat/bin/startup.sh

and immediately see result:

Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.

However after that it still takes couple hours to load Welcome Screen or Manager App in browser.

@Edit

After hours of waiting http works like a charm but https does not respond (timeout error).

I was setting up SSL certificate from letsencrypt.org on tomcat according to this tutorial with changing port 8443 in server.xml:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
    maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateFile="conf/cert.pem"
                 certificateKeyFile="conf/privkey.pem"
                 certificateChainFile="conf/chain.pem" />
          </SSLHostConfig>
</Connector>

To port 443:

<Connector port="443"     protocol="org.apache.coyote.http11.Http11NioProtocol"
    maxThreads="150" SSLEnabled="true">
        ...
</Connector>
JustinKSU
  • 4,875
  • 2
  • 29
  • 51
Tomasz Kot
  • 66
  • 5

1 Answers1

0

The exact reason is still mystery but "reinstall everything" did job well. Probably I did some mistakes during installation of Tomcat or Java.

If anyone will face similar problem here is how I configured it.

  1. Install java via apt.

  2. Install tomcat as service started with systemctl.

  3. Add letsencrypt via certbot.

  4. Redirect ports using iptables.

  5. Enable CORS according to documantation.

Tomasz Kot
  • 66
  • 5