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

Native: Parsing Error #30

Closed
gesker opened this issue Mar 30, 2023 · 15 comments
Closed

Native: Parsing Error #30

gesker opened this issue Mar 30, 2023 · 15 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@gesker
Copy link

gesker commented Mar 30, 2023

When trying to compile using native profile I'm getting a parser error. Adding the jakarta-el dependency resolves the issue:

        <dependency>
            <groupId>jakarta.el</groupId>
            <artifactId>jakarta.el-api</artifactId>
            <version>5.0.0</version>
        </dependency>

That seems to be the most current version over at maven but not sure if there is a newer version related to Jakarta EE 10. This "might" be a leftover from version 9.

Anyway, could this dependency be added directly to quarkus-primefaces?

Parsing error thrown without this jar is:

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing org.primefaces.el.InterceptingResolver.getFeatureDescriptors(jakarta.el.ELContext, java.lang.Object) 
Parsing context:
   at org.primefaces.el.InterceptingResolver.getFeatureDescriptors(InterceptingResolver.java:77)
   at org.primefaces.el.InterceptingResolver.getFeatureDescriptors(InterceptingResolver.java:77)
[snip]
   at org.primefaces.el.InterceptingResolver.getFeatureDescriptors(InterceptingResolver.java:77)
   at org.primefaces.el.InterceptingResolver.getFeatureDescriptors(InterceptingResolver.java:77)

        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:153)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:104)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureFlowsGraphCreated(MethodTypeFlow.java:83)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraph(MethodTypeFlow.java:65)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultSpecialInvokeTypeFlow.onObservedUpdate(DefaultSpecialInvokeTypeFlow.java:61)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.TypeFlow.lambda$addObserver$0(TypeFlow.java:455)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: jakarta.el.ELResolver.getFeatureDescriptors(jakarta.el.ELContext, java.lang.Object). This error is reported at image build time because class org.primefaces.el.InterceptingResolver is registered for linking at image build time by command line
        at parsing org.primefaces.el.InterceptingResolver.getFeatureDescriptors(InterceptingResolver.java:77)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2518)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:110)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3393)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3345)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3190)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1138)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:97)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:84)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:446)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:135)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:685)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:171)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:349)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:93)
        ... 12 more
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: jakarta.el.ELResolver.getFeatureDescriptors(jakarta.el.ELContext, java.lang.Object). This error is reported at image build time because class org.primefaces.el.InterceptingResolver is registered for linking at image build time by command line
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:333)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:323)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:279)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeVirtual(BytecodeParser.java:1721)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5286)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3385)
        ... 27 more

@melloware
Copy link
Contributor

Interesting because the MyFaces Quarkus Extension already has this...and it was working for the previous rev?

        <!-- EL implementation -->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jasper-el</artifactId>
            <version>11.0.0-M1</version>
        </dependency>

@melloware
Copy link
Contributor

See this:
image

@melloware
Copy link
Contributor

My GitHub Actions does a native build of a PrimeFaces app every time I commit and you can see the Native build worked here: https://github.com/quarkiverse/quarkus-primefaces/actions/runs/4568837815/jobs/8064383108

@gesker
Copy link
Author

gesker commented Mar 31, 2023

So, I jumped over the the quarkus-faces project as I'm mostly modeling my setup versus that project and ran:

❯ mvn dependency:tree | grep el-api
[INFO] |  |  \- jakarta.el:jakarta.el-api:jar:5.0.1:compile
[INFO] |  |  \- org.apache.tomcat:tomcat-el-api:jar:11.0.0-M1:compile

I excluded org.apache.tomcat:tomcat-el-api from the org.apache.myfaces.core.extension.quarkus:myfaces-quarkus

        <dependency>
            <groupId>org.apache.myfaces.core.extensions.quarkus</groupId>
            <artifactId>myfaces-quarkus</artifactId>
            <version>${myfaces.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-el-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Then I reran the dependency check to verify that the tomcat-el-api was being in fact excluded and reran the native build

❯ mvn dependency:tree | grep el-api
[INFO] |  |  \- jakarta.el:jakarta.el-api:jar:5.0.1:compile
❯ mvn clean compile package -Pnative 

That project built fine -- which I didn't expect -- and that led me to believe that the reason it was building fine was that the jakarta.el-api lib was picked up and available via the quarkus-hibernate-validator dependency which transitively pulls in expressly which in turn pulls in jakarta.el-api 5.0.1.

I had NOT been adding myfaces-quarkus to my own project as it is included in both quarkus-primefaces and quarkus-omnifaces and it isn't listed on the code.quarkus.io so I figured it wasn't critical. Still, adding myfaces-quarkus did not resolve the parser error for me but adding jakarta.el-api did.

So, I kind of reached the conclusion that jakarta.el-api was what was really needed here in this project; quarkus-primefaces. And, might be needed in quarkus-omnifaces, too???

Now, here in the quarkus-primefaces which I didn't build yet but did try to run a dependency:tree both libraries show up often:

❯  mvn dependency:tree | grep el-api;
[INFO] |  |  |  +- jakarta.el:jakarta.el-api:jar:5.0.1:compile
[INFO] |  |  \- org.apache.tomcat:tomcat-el-api:jar:11.0.0-M3:compile
[INFO] |  |  |  \- org.apache.tomcat:tomcat-el-api:jar:11.0.0-M3:compile
[INFO]    |  +- jakarta.el:jakarta.el-api:jar:5.0.1:compile
[INFO] |  |  |  \- org.apache.tomcat:tomcat-el-api:jar:11.0.0-M3:compile
[INFO] |  |  |  +- jakarta.el:jakarta.el-api:jar:5.0.1:compile
[INFO] |  |  |  +- jakarta.el:jakarta.el-api:jar:5.0.1:compile
[INFO] |  |  \- org.apache.tomcat:tomcat-el-api:jar:11.0.0-M3:compile
[INFO] |  |  |  \- org.apache.tomcat:tomcat-el-api:jar:11.0.0-M3:compile
[INFO]    |  +- jakarta.el:jakarta.el-api:jar:5.0.1:compile
[INFO] |  |  |  \- org.apache.tomcat:tomcat-el-api:jar:11.0.0-M3:compile
[INFO] |  |  |  +- jakarta.el:jakarta.el-api:jar:5.0.1:compile
[INFO] |  |     |  +- jakarta.el:jakarta.el-api:jar:5.0.1:compile
[INFO] |  |  |  |  \- org.apache.tomcat:tomcat-el-api:jar:11.0.0-M3:compile

But, as in the earlier dependency:tree run, jakarta.el-api doesn't seem to be included with quarkus-primefaces over at sonatype.

Did I hunt that down the right way? I know I got to my conclusion in a sort of a round about way.

And, at the moment, I'm not 100% sure I reached the right conclusion even at that as my guess would have been that tomcat-el-api being included would have gotten the job done. So, maybe tomcat-el-api is what really needs a look?

What do you think?

@melloware
Copy link
Contributor

When I run mvn dependency:tree | grep el-api on my Quarkus Faces project I get this...

[INFO] |  |  \- jakarta.el:jakarta.el-api:jar:5.0.1:compile
[INFO] |  |  \- org.apache.tomcat:tomcat-el-api:jar:11.0.0-M3:compile

@gesker
Copy link
Author

gesker commented Mar 31, 2023

My guess is that the Quarkus Faces project would not build if it was not importing quarkus-hibernate-validator which contains the transitive jakarta.el-api and would throw "unresolved method during parsing: jakarta.el.ELResolver" ??

@melloware
Copy link
Contributor

melloware commented Mar 31, 2023

I think you need that though because Native is going To find a whole bunch of javax validation classes it's going to say are missing. So not sure why you are not including hibernate validator??

That is the whole jakarta bean validation package.

@gesker
Copy link
Author

gesker commented Mar 31, 2023 via email

@melloware melloware self-assigned this Mar 31, 2023
@melloware melloware added the enhancement New feature or request label Mar 31, 2023
@melloware melloware added this to the 3.12.3 milestone Mar 31, 2023
@melloware
Copy link
Contributor

OK added to the pom.xml no harm in me adding it here.

@gesker
Copy link
Author

gesker commented Mar 31, 2023

If this is really a once in a blue moon kind of a thing a DNF or Won't Fix is not the end of the world AT ALL.
Like you pointed out it is probably very unlikely that most won't have validators in place.
In any event... Thank you, Sir @melloware!

@melloware
Copy link
Contributor

Interesting check this out I am getting a native build failure now on GitHub Actions: https://github.com/quarkiverse/quarkus-primefaces/actions/runs/4577321096/jobs/8082584255

melloware added a commit that referenced this issue Mar 31, 2023
This reverts commit e824ff2.
@gesker
Copy link
Author

gesker commented Mar 31, 2023 via email

@melloware
Copy link
Contributor

Yep I reversed it I just can't explain why that break it when you said it solves your issue.

@gesker
Copy link
Author

gesker commented Apr 1, 2023

I simplified my current project/module (micro ui that doesn't include validators) and the module again compiles down to native -- no parser errors. So, a step forward.

But, as soon as I get a successful native package I'm again getting "Warning: Could not resolve java.xxx for reflection Reason" Now, I kind of expected to require adding some @RegisterForReflection decorations to my own classes but I didn't think these for " java" and jakarta .faces classes wold be something I'd see so scratching my head on that. So, a step backward.

image

Actually, to the point of thinking my dev station was setup oddly wrong for some reason so I fired up a vanilla vm, setup a fresh debian/openjdk environment and seeing the strange warnings there, too.

So, just tried a couple of other projects where the aim is to flip some traditional wars to quarkus where primefaces is one of the maven submodules and kind of the same thing. First round after bumping to 3.0.0 CR1. All is fine in regular packaging. Things run quite well. As soon as try to package native I'm chasing jar/lib conflicts that kind of don't make sense at first look like - especially after this discussion her on this issue, and #32 and #31.

All good -- and actually quite snappy btw -- until I try to package native.

I was going to joke that I got caught in jar hell Friday but now I'm not sure which hell I'm in? :)

I've got a lot of these projects and over time I got very disciplined about my "dependencyManagement" configuration it it's relationship to the sub-modules. I haven't visited jar hell in a long long loooong time.

My guess is probably not jar hell but more of a "I just hit a steeper part of my grallvm learning curve." For instance, not related to this but similar experience, I ran into a self inflicted wound on a misplaced decoration that was in the wrong place for a sub-module where the service was interacting with the db. Never got an error in Quarkus 2.x. Then in getting ready for the upgrade to Quarkus 3 I got errors and I blew a few days trying to understand what graalvm was telling me until a kind soul over at Quarkus threw me a little help here quarkusio/quarkus#32188 (comment) and here quarkusio/quarkus#32298.

In the new week, probably later in the week, I think I'm going to carve out some time to try create a new mulit-module project with a single ui module and connect it to a single service module and try to zero in. If I can get a reliable failure I'll create a reproducer.

Thank you so much @melloware for your patience and have a great weekend!

@melloware
Copy link
Contributor

Yep let me know. I am more than happy to tweak GraalVm settings in PF, OmniFaces, MyFaces if we find stuff missing but minimal reproducers definitely help! I have always been using QuarkusFaces since its a worst case scenario "uses everything".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants