Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeploymentConfigurationFactory can't load flow-build-info.json on Quarkus #9713

Closed
mvysny opened this issue Dec 22, 2020 · 3 comments · Fixed by vaadin/quarkus#8
Closed

DeploymentConfigurationFactory can't load flow-build-info.json on Quarkus #9713

mvysny opened this issue Dec 22, 2020 · 3 comments · Fixed by vaadin/quarkus#8

Comments

@mvysny
Copy link
Member

mvysny commented Dec 22, 2020

The DeploymentConfigurationFactory class uses DeploymentConfiguration.class.getClassLoader() to load flow-build-info.json file. Unfortunately, Quarkus loads vaadin jars in a classloader different from the 'app' classloader which actually contains the flow-build-info.json file. That makes the DeploymentConfigurationFactory class fail to find the flow-build-info.json file, ultimately failing to initialize with

2020-12-22 16:59:03,834 ERROR [io.und.req.io] (executor-thread-4) Exception handling request 310f94c1-5596-4340-ab15-d78bb8230b2a-6 to /VAADIN/static/server/workbox/workbox-sw.js: java.lang.IllegalStateException: The compatibility mode is explicitly set to 'false', but there are neither 'flow-build-info.json' nor 'webpack.config.js' file available in the project/working directory. Ensure 'webpack.config.js' is present or trigger creation of 'flow-build-info.json' via running 'prepare-frontend' Maven goal.
	at com.vaadin.flow.server.DeploymentConfigurationFactory.verifyMode(DeploymentConfigurationFactory.java:465)
	at com.vaadin.flow.server.DeploymentConfigurationFactory.lambda$readBuildInfo$1ac205d3$1(DeploymentConfigurationFactory.java:192)
	at com.vaadin.flow.server.DefaultDeploymentConfiguration.checkCompatibilityMode(DefaultDeploymentConfiguration.java:320)

The solution is to use context class loader: Thread.currentThread().getContextClassLoader().getResources(tokenResource). Alternatively we can use Vaadin 19 and take advantage of the new Lookup SPI.

Versions:

- Vaadin / Flow version: 14.4.4 / 2.4.3
- Java version: 11
@mshabarov
Copy link
Contributor

For Vaadin 14.4/ Flow 2.4 there is a workaround which allows to avoid the exception and start the app (but it won't be possible to use token file to configure the app):

  1. Create a custom impl of VaadinServlet
  2. Override the following method and exclude the compatibility mode check as follows:
@Override
protected DeploymentConfiguration createDeploymentConfiguration(Properties initParameters) {
   initParameters.remove(DeploymentConfigurationFactory.DEV_MODE_ENABLE_STRATEGY);
   return new DefaultDeploymentConfiguration(getClass(), initParameters);
}

@mvysny
Copy link
Member Author

mvysny commented Jan 7, 2021

Thank you @mshabarov , unfortunately that workaround is not possible because of https://github.com/vaadin/flow/issues/9755

@pleku
Copy link
Contributor

pleku commented Jun 10, 2021

Acceptance Criteria

  • Add a new QuarkusResourceProvider implements ResourceProvider into the new vaadin/quarkus artifact

caalador added a commit to vaadin/quarkus that referenced this issue Jun 11, 2021
Add a ResourceProvider for Quarkus.

fixes vaadin/flow#9713
@caalador caalador self-assigned this Jun 16, 2021
caalador added a commit to vaadin/quarkus that referenced this issue Jun 16, 2021
Add a ResourceProvider for Quarkus.

fixes vaadin/flow#9713
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants