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

ClassNotFoundException when running TaskGenerateOpenAPI with flow-maven-plugin #3206

Open
mshabarov opened this issue Feb 5, 2025 · 1 comment
Labels
bug Something isn't working hilla Issues related to Hilla

Comments

@mshabarov
Copy link
Contributor

Describe the bug

Due to the latest changes in Hilla endpoints discovery, the projects that use flow-maven-plugin and vaadin-spring-boot-starter (e.g. MPR + Spring projects) are failing with

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.loader.tools.MainClassFinder
    at jdk.internal.loader.BuiltinClassLoader.loadClass (BuiltinClassLoader.java:641)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:525)
    at com.vaadin.flow.plugin.maven.Reflector$CombinedClassLoader.loadClass (Reflector.java:392)
    at com.vaadin.hilla.engine.AotBrowserCallableFinder.determineApplicationClass (AotBrowserCallableFinder.java:59)
    at com.vaadin.hilla.engine.AotBrowserCallableFinder.findEndpointClasses (AotBrowserCallableFinder.java:36)
    at com.vaadin.hilla.engine.EngineConfiguration.lambda$getBrowserCallableFinder$1 (EngineConfiguration.java:130)
    at com.vaadin.hilla.internal.TaskGenerateOpenAPIImpl.execute (TaskGenerateOpenAPIImpl.java:64)
    at com.vaadin.flow.server.frontend.NodeTasks.execute (NodeTasks.java:347)
    at com.vaadin.flow.plugin.base.BuildFrontendUtil.runNodeUpdater (BuildFrontendUtil.java:364)
    at com.vaadin.flow.plugin.maven.BuildFrontendMojo.executeInternal (BuildFrontendMojo.java:143)

Note: MPR project uses flow-maven-plugin, because they need to also run the V8 vaadin-maven-plugin.

The problem happens if the project is using vaadin-spring-boot-starter.
When building for production the Hilla's TaskGenerateOpenAPIImpl is called and it fails because of java.lang.ClassNotFoundException: org.springframework.boot.loader.tools.MainClassFinder.

The easy fix is to exclude Hilla from a project, but it's a breaking change.

Expected-behavior

Project should not fail event though it's being build with flow-maven-plugin instead of vaadin-maven-plugin.

Reproduction

Can be reproduced with the MPR test module Session IT.

System Info

Vaadin 24.7.0.alpha7 or 24.7-SNAPSHOT.

@mshabarov mshabarov added bug Something isn't working hilla Issues related to Hilla labels Feb 5, 2025
@mcollovati
Copy link
Contributor

Another workaround is to use hilla-maven-plugin instead of flow-maven-plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hilla Issues related to Hilla
Projects
None yet
Development

No branches or pull requests

2 participants