Skip to content

Conversation

@rmpestano
Copy link
Contributor

@rmpestano rmpestano commented Mar 1, 2020

  • Enable native mode
  • Adds tests on showcase module (jvm and native)

We still miss an automatic way to register JSF managed beans for reflection

rmpestano added 2 commits March 1, 2020 20:05
- adds tests for jvm and native mode
- adds readme for showcase
@rmpestano rmpestano changed the title Native mod support Native mode support Mar 1, 2020
@rmpestano rmpestano changed the title Native mode support Quarkus native mode support Mar 1, 2020
@tandraschko
Copy link
Member

Thanks Rafael,
I will merge it.

However i will remove the showcase from the normal build from now, to not "influence" the normal MF builds

@tandraschko tandraschko merged commit 6c5845c into apache:master Mar 2, 2020
@rmpestano
Copy link
Contributor Author

Yes sure, thank you for the guidance on this PR!

Also for the showcase, maybe we can put it on the PrimeFaces extension module (not sure you want to have one on this repo) and maybe create a simpler showcase for pure MyFaces. This way we could cleanup this extension (mainly the required deps for PrimeFaces on runtime module, primefaces application marker and resource bundle entries), I can help in case you need, just let me know

@tandraschko
Copy link
Member

@rmpestano sure :)

I already splitted up the methods for now. Will commit it soon.
Also i will try to scan @nAmed beans and loop public getter and register them.

Some questions:

  1. QuarkusExceptionHandlerFactory.class.getName(); you added this but we already collect all "ExceptionHandlerFactory" classes and impls; do we really need this?

import com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl;
import com.sun.org.apache.xpath.internal.functions.FuncLocalPart;
import com.sun.org.apache.xpath.internal.functions.FuncNot;

do we really need this reflection support?

@rmpestano
Copy link
Contributor Author

rmpestano commented Mar 2, 2020

For 1, if we remove it we get:

java.lang.ClassNotFoundException: org.apache.myfaces.core.extensions.quarkus.runtime.exception.QuarkusExceptionHandlerFactory
        at com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:60)
        at java.lang.Class.forName(DynamicHub.java:1224)
        at org.apache.myfaces.util.lang.ClassUtils.classForName(ClassUtils.java:155)

For some reason it not gets collected in collectClassAndSubclasses, I think it's because it is defined on the extension itself....

For 2, i get:

Could not load or parse web-fragment.xml
Could not load or parse web-fragment.xml

even though the application works without issues. I only get that message on the console and nothing more, for some reason on MacOS the native image is not generating the debug.log file, I need to test on Ubuntu to see if I get a stack trace. This is what I got:

Screenshot 2020-03-02 at 11 37 13

@rmpestano
Copy link
Contributor Author

rmpestano commented Mar 2, 2020

By the way, I'm using this command to run the test against a generated native image:

mvn failsafe:integration-test -Pnative -Dquarkus.test.native-image-profile=dev -Dnative.image.path=target/quarkus-myfaces-showcase-1.0-SNAPSHOT-runner -Dquarkus.log.file.path=target/debug.log

Note that failsafe is overriding the quarkus.log.file.path parameter (we also have it on application.properties)

@tandraschko
Copy link
Member

@rmpestano
i refactored the whole thing
moved PF to own methods
and loop all @nAmed beans + public fields / getters

can you give it a try?

@rmpestano
Copy link
Contributor Author

It is working great @tandraschko, awesome work!
Also the native image size still the same, around 108 MB

@tandraschko
Copy link
Member

great!

Can we also remove RestoreViewSupport from reflection support?

@tandraschko
Copy link
Member

i also added DocumentBuilderFactory as class/subclass instead of using the Impl name directly

@rmpestano
Copy link
Contributor Author

Can we also remove RestoreViewSupport from reflection support?

Yes, we can 👍

@rmpestano
Copy link
Contributor Author

If someone is watching this thread and uses a MacOS (probably also linuxes distros), can you try to run following native binary and access localhost:8080/index.xhtml?

https://drive.google.com/open?id=1m7pNtWu3Gz7YVXkcJH-fqMYVP45GennE

@tandraschko
Copy link
Member

great, removed it!

I will try to setup the PF quarkus soon

@wtlucy
Copy link
Contributor

wtlucy commented Mar 2, 2020

@rmpestano at a glance, the binary runs fine on my MacOS Mojave system

@rmpestano
Copy link
Contributor Author

rmpestano commented Mar 2, 2020

Thank you for looking at it @wtlucy!

PS: I am also on Mojave, maybe someone with Catalina would be a nice test.

@rmpestano
Copy link
Contributor Author

rmpestano commented Mar 2, 2020

Following is the linux_x64 native image, if someone wants to try:
https://drive.google.com/open?id=1hf_Vyflz732_RFzX9S7C3wYlDWJaCWFP

I've tested on Ubuntu 18.04.4

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants