Я создаю веб-приложение, используя Embedded Tomcat. Я пытался использовать последнюю версию 9 (9.0.10), но при запуске сервера казалось, что он не работает при доступе в браузере. Firefox сообщает Невозможно подключиться Firefox не может установить соединение с сервером по адресу localhost:8080. Журналов ошибок не было.
Но, когда сменил версию на 8 (8.5.32), заработало. Я также заметил разницу между их журналами консоли:
Томкэт 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.
Томкэт 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"]
Я заметил два основных отличия:
- 16 августа 2018 г. 14:41:33 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector --- Хотя, начиная с версии 8 и вплоть до последней, Tomcat уже основан на NIO, поскольку BIO был удален. Но этот журнал появляется только на 8
- Tomcat 8 отображает порт, на котором работает сервер.
Может ли кто-нибудь помочь мне понять это? Спасибо.
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 []
- person Jim Garrison   schedule 16.08.2018