Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Tomcat Last updated: September 6, 2022
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Apache Tomcat getting stuck while starting

Lately, I was working on Tomcat 9 and encountered an issue. It was getting stuck at the following stage during startup.

22-Sep-2018 03:06:00.347 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/root/apache-tomcat-9.0.12/temp
22-Sep-2018 03:06:00.347 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
22-Sep-2018 03:06:00.601 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
22-Sep-2018 03:06:00.629 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-Sep-2018 03:06:00.650 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
22-Sep-2018 03:06:00.651 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
22-Sep-2018 03:06:00.665 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1341 ms
22-Sep-2018 03:06:00.738 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
22-Sep-2018 03:06:00.738 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/9.0.12
22-Sep-2018 03:06:00.766 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/apache-tomcat-9.0.12/webapps/ROOT]

Are you also having the same issue?

Usually, this happens on VM and here is how you can fix this. Take a backup of a file before modifying and if feasible, test in a non-production environment.

  • Go to Tomcat installation folder and then bin
  • Open catalina.sh using the vi editor
  • Search for JAVA_OPTS and add the following
-Djava.security.egd=file:/dev/./urandom

For example, I added it here.

JAVA_OPTS="$JAVA_OPTS $JSSE_OPTS -Djava.security.egd=file:/dev/./urandom"
  • Save the file and restart Tomcat

Look at the catalina.out file and it should be started.

22-Sep-2018 05:44:26.898 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/apache-tomcat-9.0.12/webapps/manager] has finished in [53] ms
22-Sep-2018 05:44:26.909 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
22-Sep-2018 05:44:26.924 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
22-Sep-2018 05:44:26.931 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 2085 ms

This simple trick has helped me, and I hope you too!

If you are learning or curious to learn more about Tomcat then check out this beginner to the advanced course.

  • Chandan Kumar
    Author
    As the founder of Geekflare, I’ve helped millions to excel in the digital realm. Passionate about technology, I’m on a mission to explore the world and amplify growth for professionals and businesses alike.
Thanks to our Sponsors
More great readings on Tomcat
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Monday.com is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder