Migrating Vaadin 10 to 14 with JBoss -> Error

Hi

Migrating from vaadin 10 to 14…

in application.proterties i’ve set the property:
vaadin.compatibilityMode=true

it still tells me that error:

Im starting vaadin with JBoss 7.1

11:53:04,902 DEBUG [ch.coop.printerportal.app.security.CustomRequestCache]
 (default task-10) saved request doesn't match
11:53:04,941 ERROR [io.undertow.request]
 (default task-12) UT005023: Exception handling request to /PrinterPortal/frontend/bower_components/webcomponentsjs/webcomponents-loader.js: java.lang.IllegalStateException: Unable to determine mode of operation. To use npm mode, ensure 'flow-build-info.json' exists on the classpath. With Maven, this is handled by the 'prepare-frontend' goal. To use compatibility mode, add the 'flow-server-compatibility-mode' dependency. If using Vaadin with Spring Boot, instead set the property 'vaadin.compatibilityMode' to 'true' in 'application.properties'.
	at com.vaadin.flow.server.DefaultDeploymentConfiguration.checkCompatibilityMode(DefaultDeploymentConfiguration.java:270) [flow-server-2.0.7.jar:2.0.7]

	at com.vaadin.flow.server.DefaultDeploymentConfiguration.<init>(DefaultDeploymentConfiguration.java:125) [flow-server-2.0.7.jar:2.0.7]

	at com.vaadin.flow.server.VaadinServlet.createDeploymentConfiguration(VaadinServlet.java:166) [flow-server-2.0.7.jar:2.0.7]

	at com.vaadin.flow.server.VaadinServlet.createDeploymentConfiguration(VaadinServlet.java:151) [flow-server-2.0.7.jar:2.0.7]

	at com.vaadin.flow.server.VaadinServlet.createServletService(VaadinServlet.java:185) [flow-server-2.0.7.jar:2.0.7]

	at com.vaadin.flow.server.VaadinServlet.init(VaadinServlet.java:72) [flow-server-2.0.7.jar:2.0.7]

	at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
	at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:300) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.core.ManagedServlet.forceInit(ManagedServlet.java:207) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.ServletChain.forceInit(ServletChain.java:117) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:60) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.ServletInitialHandler.jrHandle(ServletInitialHandler.java:40001) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at org.zeroturnaround.javarebel.integration.servlet.undertow.cbp.ServletInitialHandlerCBP.handleRequest(ServletInitialHandlerCBP.java:101) [undertow-servlet-jr-plugin-2019.1.4.jar:]

	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1501)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) [undertow-servlet-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:330) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812) [undertow-core-1.4.18.SP8-redhat-1.jar:1.4.18.SP8-redhat-1]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_181]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_181]

	at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_181]



If you’re not using Spring, then application.properties is ignored. Please try adding the following dependency to your pom.xml instead:

<dependency>
  <groupId>com.vaadin</groupId>
  <artifactId>flow-server-compatibility-mode</artifactId>
  <version>2.0.7</version>
</dependency> 

However, if you have older app server (older than Servlet 3.0) it will not work.

I have the same error running with an embedded Jetty (latest 9.4.20 version). I have added the POM dependency, to no avail. This used to work with the RC2 release.

I have the same problem on embedded Jetty 9.4.20.v20190813 version.
vaadin-core version: 14.0.2
flow-server-compatibility-mode version: ‘2.0.9’

Have any idea?

Martin Vyšný:
If you’re not using Spring, then application.properties is ignored. Please try adding the following dependency to your pom.xml instead:

<dependency>
  <groupId>com.vaadin</groupId>
  <artifactId>flow-server-compatibility-mode</artifactId>
  <version>2.0.7</version>
</dependency> 

However, if you have older app server (older than Servlet 3.0) it will not work.

Its JBoss 7.1 has Servlet 3.0 but still doesnt work.

Flow needs Servlet 3.1, actually, 3.0 is not enough. See here: https://github.com/vaadin/platform/releases/tag/14.0.2

Vaadin Flow requires Java Servlet API 3.1 (JSR-340) or newer. It is tested on:

Apache Tomcat 8.0.x, 8.5, 9

Apache TomEE 7.0.4->

Oracle WebLogic Server 12.2.1

IBM WebSphere Application Server 8.5 Liberty Profile and 9

RedHat JBoss EAP 7

WildFly 14, 15, 16

Jetty 9.4

Payara Server

Payara Micro

it is 3.1 in JBoss 7. Its actually 4.0 even since i use JBoss 7.2

https://access.redhat.com/articles/113373

I cannot start the bakery App in Development mode. Did you ever test your framework under JBoss?

One workaround for Jetty is to forcibly set compatibility mode by setting an environment variable in your Main class, prior to starting Jetty.

        // force bower compatibility mode until we move to npm
        System.setProperty("vaadin.compatibilityMode", "true");

Unfortunately, this will prevent you from using v14 code using npm – there is no “mixed mode”.

Jean-François Lamy:
One workaround for Jetty is to forcibly set compatibility mode by setting an environment variable in your Main class, prior to starting Jetty.

        // force bower compatibility mode until we move to npm
        System.setProperty("vaadin.compatibilityMode", "true");

Unfortunately, this will prevent you from using v14 code using npm – there is no “mixed mode”.

Thank you. It is work.

There is a way to use embedded Jetty with Vaadin 14 in NPM mode: https://github.com/mvysny/vaadin14-embedded-jetty

Thank you Martin. I actually have three objectives –

  1. running 14 in NPM mode as an embedded app (I had actually managed this just before I saw your post – I will compare with what you did);
  2. deploying to Heroku with NPM – I need a uberjar for the purpose of creating a windows installer as well, I’ll study what you did
  3. finally, adding an additional websocket connection beyond Atmosphere, which will require that I carefully add an extra handler to the Jetty config without breaking anything…