flow
flow copied to clipboard
Reflection error attempting to run Vaadin 23 with Java 17 on Wildfly
Description of the bug
The method com.vaadin.base.devserver.startup.DevModeInitializer.generateJarFromJBossVfsFolder(Object jarVirtualFile, Path tempJar) fails with NoSuchMethodException when it attempts to use reflection on virtualFileClass.getMethod("getChildrenRecursively").
This is caused by the method com.vaadin.base.devserver.startup.DevModeInitializer.getPhysicalFileOfJBossVfsJar(URL url) on line Object jarVirtualFile = url.openConnection().getContent(); because it returns an instance of org.jboss.vfs.VirtualJarInputStream when run in Java 17, instead of the expected org.jboss.vfs.VirtualFile as when run in Java 15.
Expected behavior
Vaadin should run on Wildfly both with Java 17 and Java 15
Minimal reproducible example
Start any Vaadin project on Wildfly using Java 17
Versions
- Vaadin / Flow version: 23.0.8
- Java version: 17.0.3
- OS version: Pop!_OS 22.04
- Browser version (if applicable): N/A
- Application Server (if applicable): Wildfly 26.1.0 (and also Wildfly 21.0.1)
- IDE (if applicable): N/A
I encountered the same problem Vaadin 14.x
and found that the culprit was the java version.
When i downgraded to 17.0.2
, it started to work again.
Maybe you should try that as a temporary workaround until the Vaadin team fixes this one.
Can confirm the problem is with Java 17.0.3, and also using 17.0.2 as workaround
The problem is https://issues.redhat.com/browse/WFLY-16322 which has apparently been solved in https://github.com/jbossas/jboss-vfs/pull/40 a month ago and released in jboss-vfs 3.2.17
I encountered the same problem Vaadin
14.x
and found that the culprit was the java version. When i downgraded to17.0.2
, it started to work again. Maybe you should try that as a temporary workaround until the Vaadin team fixes this one.
17.0.2 has quite a serious security flaw failing to properly validate certificates. I would not suggest falling back to 17.0.2, but rather to patch the module jboss-vfs to use the updated jboss-vfs version. Which is not too difficult to perform: you need to modify the module.xml in the <wildfly>/modules/system/layers/base/org/jboss/vfs/main
folder to match the 3.2.17.Final version number, and copy the jboss-vfs-3.2.17.Final.jar into that folder, and (re)start your wildfly.
I get the same problem with Java 11.0.16 (OpenJDK) and JBoss EAP 7.3. I still need to check if there is an official update for JBoss EAP 7.3. Patching jboss-vfs fixes the problem.
Still, a more helpful error message would be appreciated as I have investigated all other possible issues before.
I've updated that reflection method during work on jakarta ee 9 (servlet 5) https://github.com/vaadin/flow/commit/c2430cc7fc8c492e51daef85416b7cc68a44da11 - CP to master? I've tested on 17.0.3 with Wildfly 26.1.1.Final (preview)
Note: This problem is fixed with Wildfly 26.1.2.Final
Related issues:
- https://issues.redhat.com/browse/WFCORE-5916 (Updates JBoss vfs to
3.2.17.Final
in Wildfly Core18.1.2.Final
) - https://issues.redhat.com/browse/WFLY-16859 (Updates Wildfly Core to
18.1.2.Final
in Wildfly26.1.2.Final
)
Can confirm that it works on WildFly 26.1.2.Final
using OpenJDK 17.0.4
I confirm that problem is solved with WildFly 26.1.2.Final (tested with Vaadin 23.2.8, OpenJDK 17.0.5). This issue can be closed.