flow icon indicating copy to clipboard operation
flow copied to clipboard

Detect servlet version and warn if the major is wrong

Open Artur- opened this issue 1 year ago • 1 comments

Describe your motivation

It is easy to start a Vaadin 23 project today and grab the latest Tomcat version to run it on. It won't work because Tomcat 10 is for servlet 5 and not servlet 3. Similarly if you grab Vaadin 24 and try to run it on Tomcat 9, it will fail.

Describe the solution you'd like

If the servlet version is wrong, a clear error message should be printed and the application startup aborted.

For Vaadin 24 it means reverting #14818 and changing the check to detect a servlet 5 method.

For Vaadin 23, it should check that the version is >= 3.1 and < 5, not only >= 3.1 as it does currently

Artur- avatar Oct 14 '22 07:10 Artur-

The existing ServletVerifier cannot actually be used for this it seems. If you deploy a Vaadin 24 app to Tomcat 9 you get

14-Oct-2022 10:31:20.504 INFO [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/.../apache-tomcat-9.0.62/webapps/myapp-1.0-SNAPSHOT.war]
14-Oct-2022 10:31:20.692 WARNING [Catalina-utility-2] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [5.0]. Default version will be used.
14-Oct-2022 10:31:20.694 WARNING [Catalina-utility-2] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [5.0]. Default version will be used.
14-Oct-2022 10:31:21.621 INFO [Catalina-utility-2] org.apache.jasper.servlet.TldScanner.scanJars 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.
14-Oct-2022 10:31:21.641 INFO [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/.../apache-tomcat-9.0.62/webapps/myapp-1.0-SNAPSHOT.war] has finished in [1,137] ms

It does not find any servlets (wrong namespace) nor does it run the existing servlet verifier which is run from a ServletContainerInitializer

Artur- avatar Oct 14 '22 07:10 Artur-

This was done in

  • #14841
  • #14842

Artur- avatar Oct 25 '22 16:10 Artur-