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

Javaassist dependencies conflict potentially breaks frontend build #20882

Open
mcollovati opened this issue Jan 20, 2025 · 1 comment
Open

Javaassist dependencies conflict potentially breaks frontend build #20882

mcollovati opened this issue Jan 20, 2025 · 1 comment

Comments

@mcollovati
Copy link
Collaborator

mcollovati commented Jan 20, 2025

When building for production, Flow plugins use an implementation of ClassFinder based on the org.reflections:reflections library, that in turn depends on org.javassist:javassist.
The javaassist version required at runtime is pinned by the plugin itself.

However, if javassist is also defined as project dependency, it could happen that class scan silently ignores some JARs because of Java version incompatibilities.

This may lead to the build succeeding, but the application not working properly at runtime because of missing frontend resource.

ERROR c.v.f.c.internal.UIInternals - The component class com.vaadin.flow.component.UI includes '@vaadin/common-frontend/ConnectionIndicator.js' but this file was not included when creating the production bundle. The component will not work properly. Check that you have a reference to the component and that you are not using it only through reflection. If needed add a @Uses(UI.class) where it is used.

The error could happen in Reflections.scan() when classes are loaded from the JAR files, and unfortunately, errors are logged at TRACE level and not visible during a Maven build even if the debug flag is on (-X)

} catch (Exception e) {
    if (log != null) log.trace("could not scan file {} with scanner {}", file.getRelativePath(), scanner.getClass().getSimpleName(), e);
}

There are two possible incompatibilities causes:

  • the project defined org.javassist:javassist dependency is older than the one expected by the Flow plugin
  • the project defines the dependency with using a deprecated groupId: javassist:javassist.

In the first case, the incompatibility is printed to the console during build.
However, in the second case, no warnings are provided because the artifact coordinates are different.

The Flow plugin should always use its own defined version of org.javassist:javassist, and ignore the javassist:javassist dependency when building the class loader used for class scan.

@Artur-
Copy link
Member

Artur- commented Jan 20, 2025

Maybe time for Classgraph instead of reflections, or does it also use javassist? See #19543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 Normal Priority (P2)
Status: 🅿️Parking lot
Development

No branches or pull requests

3 participants