Tomcat 8和9之间的区别

时间:2018-08-16 06:45:55

标签: java tomcat nio tomcat8

我正在使用嵌入式Tomcat创建Web应用程序。我尝试使用最新版本9(9.0.10),但是在服务器启动时,似乎无法在浏览器上运行。 Firefox表示无法连接Firefox无法在localhost:8080建立与服务器的连接。。没有错误日志。

但是,当将版本更改为8(8.5.32)时,它可以工作。我还注意到了他们的控制台日志之间的区别:

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"]

我注意到的两个主要区别是:

  1. 2018年8月16日下午2:41:33 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector ---虽然从版本8到最新版本,但Tomcat已经基于NIO,因为BIO已被删除。但是此日志仅出现在8
  2. Tomcat 8显示服务器正在运行的端口。

有人可以帮助我理解这些吗?谢谢。

0 个答案:

没有答案