I am creating web application using Embedded Tomcat. I tried to use the latest version 9 (9.0.10), but while the server started, it seemed that it's not running when accessed on browser. Firefox says Unable to connect Firefox can’t establish a connection to the server at localhost:8080.. There were no error logs.
But, when changed the version to 8 (8.5.32), it worked. I also noticed the difference between their console logs:
Tomcat 9.0.10:
Aug 16, 2018 2:19:46 PM org.apache.catalina.core.StandardContext setPath
WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
Aug 16, 2018 2:19:47 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Aug 16, 2018 2:19:47 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/9.0.10
Aug 16, 2018 2:19:47 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
Aug 16, 2018 2:19:47 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Tomcat 8.5.32:
Aug 16, 2018 2:41:32 PM org.apache.catalina.core.StandardContext setPath
WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
Aug 16, 2018 2:41:33 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Aug 16, 2018 2:41:33 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Aug 16, 2018 2:41:33 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Aug 16, 2018 2:41:33 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.32
Aug 16, 2018 2:41:33 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
Aug 16, 2018 2:41:33 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Aug 16, 2018 2:41:33 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Two primary differences I noticed are:
- Aug 16, 2018 2:41:33 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector --- I though from version 8 up to the latest, Tomcat is already NIO based as BIO has been removed. But this log only appears on 8
- Tomcat 8 displays port the server is running on.
Can anyone help me understand these? Thanks.