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

Flow 24 alpha does not work on payara-micro due to ASM incompatibility #15625

Closed
MarcinVaadin opened this issue Jan 5, 2023 · 10 comments
Closed

Comments

@MarcinVaadin
Copy link
Member

Description of the bug

From StackOverflow:

I tried to run Vaadin Flow 24.0.0.alpha7 (because it supports Jakarta EE 9) on Payara Micro but Vaadin servlet didn't deploy.

I believe Payara Micro 6.2022.2 should support it theoretically however when I tried to run it on Java 17 I got multiple errors of this sort:

Exception while visiting com/vaadin/flow/data/provider/SortDirection.class of size 1425
java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
When I switched to Java 19 I got the same ASM9 errors plus a bunch of new ones like this:

Exception while visiting WEB-INF/classes/one/esng/ang/ui/views/MainLayout.class of size 3967
java.lang.IllegalArgumentException: Unsupported class file major version 63
Is there any way to make it work?

Expected behavior

Should work

Minimal reproducible example

we should add payara-micro example to one of skeleton starter modules

Versions

  • Vaadin / Flow version: 24 alpha8
  • Java version: 17
  • Application Server (if applicable): payara-micro 6.xx
@Artur-
Copy link
Member

Artur- commented Jan 5, 2023

Payara issue: payara/Payara#6127

@knoobie
Copy link
Contributor

knoobie commented Jan 5, 2023

How about changing the enum to something like this to remove the need of the kinda fancy stuff ;)

public enum SortDirection {

  /**
   * Ascending (e.g. A-Z, 1..9) sort order
   */
  ASCENDING(Constants.ASCENDING_OPPOSITE),

  /**
   * Descending (e.g. Z-A, 9..1) sort order
   */
  DESCENDING(Constants.DESCENDING_OPPOSITE);

  private final SortDirection opposite;

  SortDirection(SortDirection opposite) {
    this.opposite = opposite;
  }

  /**
   * Get the sort direction that is the direct opposite to this one.
   *
   * @return a sort direction value
   */
  public SortDirection getOpposite() {
    return opposite;
  }

  private static class Constants {

    public static final SortDirection ASCENDING_OPPOSITE = DESCENDING;
    public static final SortDirection DESCENDING_OPPOSITE = ASCENDING;
  }
}

@MarcinVaadin
Copy link
Member Author

Same issue for com/vaadin/flow/component/grid/Grid$SelectionMode.class.

@mshabarov
Copy link
Contributor

Also

  Exception while visiting com/vaadin/flow/component/internal/ComponentTracker$Location.class of size 2124
java.lang.UnsupportedOperationException: Record requires ASM8
        at org.objectweb.asm.ClassVisitor.visitRecordComponent(ClassVisitor.java:305)
        at org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:953)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:731)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:424)
        at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:336)
        at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:164)
        at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:130)
        at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:321)
        at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:44)
        at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:280)
        at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:269)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

@Artur-
Copy link
Member

Artur- commented Jan 24, 2023

Is there anything for us to do here or should we close this issue and wait for Payara to fix their deps?

@mshabarov
Copy link
Contributor

I suggest first to try change the Flow codes for SortDirection, ComponentTracker$Location and Grid$SelectionMode and see if there Payara would start then.

Example to reproduce https://github.com/vaadin/skeleton-starter-flow-cdi/tree/v24-payara :
mvn clean package payara-micro:start

@mshabarov
Copy link
Contributor

Tested the above starter with patched Flow https://github.com/vaadin/flow/tree/flow-payara and Flow Grid https://github.com/vaadin/flow-components/tree/grid-payara
I got basically only one error:

[2023-01-24T19:25:42.714+0200] [] [SEVERE] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1674581142714] [levelValue: 1000] Exception while visiting sun.security.util.KnownOIDs

and a blank page:
Screenshot 2023-01-24 at 19 29 55

No errors in the browser console or network tab.
Will set a verbose logging level for the server and see.

@mcollovati
Copy link
Collaborator

The problem seems to be that MainView is not considered a CDI bean, and thus its @PostConstructor is not invoked, so child components are not added to the view

@mcollovati
Copy link
Collaborator

The same happens with wildfly 27 (alpha), so the problem is with Jakarta EE 10 and CDI 4, that changed the default bean discovery mode to annotated, as mentioned in vaadin/cdi#411

mshabarov added a commit that referenced this issue Jan 30, 2023
mshabarov added a commit that referenced this issue Jan 31, 2023
* fix: Make Flow compatible with ASM framework

Solution for #15625, until payara/Payara#6127 is fixed.

* Simplifications

* Change getter names and add final

* fix formatting
@mcollovati
Copy link
Collaborator

Just tested against latest Flow and grid modules and the ASM issues seems to be resolved.
For the blank page issue I will create a PR on skeleton-starter-flow-cdi repository to add the @CdiComponent to MainView, so it will be detected as a CDI bean and lifecycle hooks will be correctly invoked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants