Hello! I would like to run Vaadin Flow on stable Debian. It has Tomcat 10 and Java 17. Vaadin Gradle Skeleton Starter works fine when I run ./gradlew appRun, but if I change the application server in build.gradle from jetty11 to tomcat10, I get the error:
SEVERE: Allocate exception for servlet [com.vaadin.flow.server.startup.ServletDeployer]
java.lang.ExceptionInInitializerError: Exception java.lang.NoSuchFieldError: JAVA_21 [in thread "main"]
at com.vaadin.copilot.Copilot.<clinit>(Copilot.java:28)
at com.vaadin.copilot.CopilotIndexHtmlLoader.serviceInit(CopilotIndexHtmlLoader.java:44)
at com.vaadin.flow.server.VaadinService.lambda$init$0(VaadinService.java:271)
...
Why does the problem occur on Tomcat 10 but not Jetty 11 and is there any way to disable Copilot?
You can exclude Copilot if you want, and that particular error should go away. However, the real problem causing the NoSuchFieldError is that somehow switching from Jetty to Tomcat introduces an older version of javaparser into the project. Not super clear why but I also see the issue
which is what causes the problem. Still not sure why that would be added to the tomcat container classpath but then it overrides the version in the application itself
Thanks for creating the Gretty issue. See this comment:
I’ve released 3.1.7 and 4.1.7. @Artur-, @Yasushi, please try the version you use and let me know if it works for you. Thanks!
I tried now
git clone git@github.com:vaadin/base-starter-gradle.git
cd base-starter-gradle
git checkout tomcat
vi build.gradle # change id 'org.gretty' version '4.1.4' to '4.1.7'
./gradlew appRun
The exception is thrown:
SEVERE: Servlet.init() for servlet [com.vaadin.flow.server.startup.ServletDeployer] threw exception
java.lang.NoSuchFieldError: JAVA_21
at com.vaadin.copilot.Copilot.<clinit>(Copilot.java:28)
at com.vaadin.copilot.CopilotIndexHtmlLoader.serviceInit(CopilotIndexHtmlLoader.java:44)
...