Prepare-frontend fails in Vaadin 24.4.1

Building my multi-module maven project fails with version 24.4.1:

[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:24.4.1:prepare-frontend (default) on project ptsmc-widgetset: Could not execute prepare-frontend goal.: Error occured during goal execution: Cannot invoke “java.lang.Class.isInterface()” because the return value of “org.reflections.Reflections.forClass(String, java.lang.ClassLoader)” is null

Building with --debug I get

[DEBUG] Can’t load class com.vaadin.componentfactory.Popup
java.lang.NoClassDefFoundError: com/vaadin/flow/component/shared/HasThemeVariant
at java.lang.ClassLoader.defineClass1 (Native Method)
at java.lang.ClassLoader.defineClass (ClassLoader.java:1012)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:150)
at java.net.URLClassLoader.defineClass (URLClassLoader.java:524)
at java.net.URLClassLoader$1.run (URLClassLoader.java:427)
at java.net.URLClassLoader$1.run (URLClassLoader.java:421)
at java.security.AccessController.doPrivileged (AccessController.java:712)
at java.net.URLClassLoader.findClass (URLClassLoader.java:420)
at java.lang.ClassLoader.loadClass (ClassLoader.java:587)
at java.lang.ClassLoader.loadClass (ClassLoader.java:520)
at com.vaadin.flow.server.scanner.ReflectionsClassFinder$LoggingReflections.forClass (ReflectionsClassFinder.java:172)

So, does this indicate a problem with the way vaadin uses reflection, or does it indicate a problem with com.vaadin.componentfactory.Popup (Version 24.0.5) ?

Reverting to Vaadin 24.3.12 build works again

Sounds like a problem in the factory component.

I’m getting the exact same error.
I’m using Java 21, Eclipse IDE.

It would be better if the Vaadin code that scans the classes reported the problem properly. I spent quite some time on this before identifying the class.

The NoClassDefFoundError for HasThemeVariant sounds like the classloader Vaadin are using haven’t been given access to all required classes?
Or, the reflection library used digs too deep?

Opening up com.vaadin.componentfactory.Popup class in Eclipse shows no issues, though I’m not sure if that proves anything.

Found this:

which links to:

Two possible causes mentioned here are:

  • dependency built with newer java
  • dependency built with --enable-preview

Both of these seem a bit unlikely, since the exact same dependency works in Vaadin 24.3.12. If the problem is with those two possible causes, it indicates that Vaadin has changed the class scanning to something that exposes it?
Unfortunately that doesn’t seem likely either, because the linked github issue was on version 23.2.17 and I ran fine on 24.3.12

Based on the linked issue, I did try to build with --enable-preview and Java21, but got the same result. Again, not sure that proves anything.

I upated to v24.4.6 today and now I am getting this very issue. WTF?
How is this resolved? I googled left and right and didn’t find any working suggestion, yet. :-(

Reverted to 24.3.8 again…

Problem with an old addon. Posting your pom might help us to understand what’s wrong in your setup.

Also, running with -X or --debug flag, as mentioned in the thread, would probably provide additional information that might help to identify the cause