Skip to content

Quarkus Faces Known Issues

Melloware edited this page Oct 25, 2024 · 19 revisions

Production

Unsupported EE Features

Due to Quarkus not being a complete EE server and not being engineered as one, it lacks support for certain functionalities that you might currently rely on in your Faces / CDI configuration.

  • You need to put your views under src/main/resources/META-INF/resources as Quarkus doesn't create a WAR and src/main/webapp is ignored!
  • Quarkus does not support session replication / passivation / clustering
  • Quarkus does not implement @ConversationScoped
  • Quarkus does not support injection in normal objects, therefore injection in Faces artifacts like NavigationHandler etc. is not supported
  • Quarkus does not support CDI Extensions see: https://quarkus.io/guides/cdi-reference#build_time_apis

Native Image

When creating a GraalVM Native image you may need to change some of your code to be native friendly and some features may not be available to use in Native mode.

  1. EL expressions which use reflection may run into issues with things like List size() or Enum name() as they are not bean compliant method names. You might need to change your EL expression or add helper code to achieve what you want.
  2. WebSocket f:websocket not supported but o:socket is supported. Faces WebSocket has an open issue https://issues.apache.org/jira/projects/MYFACES/issues/MYFACES-4685 but OmniFaces o:socket works well!
  3. FeedReader not supported. Rome library uses JDOM and I am too lazy to look into what needs to be done. In PrimeFaces 15.0.0 its switching to an new RSS library that has Zero Dependencies so it will be able to be native in 15.0.0
  4. PDF Exporter / Barcode components that rely on Java AWT, ensure AWT and the necessary .so libraries are included in your Dockerfile. Additionally, fonts must be installed for PDF functionality. The Dockerfile configuration below demonstrates how to set this up correctly for native mode.
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.10

######################### Set up environment for POI ##########################
RUN microdnf update && microdnf install freetype fontconfig && microdnf clean all
######################### Set up environment for POI ##########################

WORKDIR /work/
RUN chown 1001 /work \
    && chmod "g+rwX" /work \
    && chown 1001:root /work
# Shared objects to be dynamically loaded at runtime as needed,
COPY --chown=1001:root target/*.properties target/*.so /work/
COPY --chown=1001:root target/*-runner /work/application
# Permissions fix for Windows
RUN chmod "ugo+x" /work/application
EXPOSE 8080
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

HV000250: Uninitialized locale

If you see the error HV000250: Uninitialized locale: en_US. Please register your locale as a locale to initialize when initializing your ValidatorFactory. then you need to add these lines to your application.properties to register the Hibernate Validator languages.

# default bean validation locale
quarkus.default-locale=en
# Load all locales in native mode
quarkus.locales=ar,ca,cs,de,en,en_US,es,fr,it,ja,mt,nl,pl,pt,pt_BR,ru,sk,uk,zh_CN,zh_HK,zh_TW

Dev mode mvn quarkus:dev

Running mvn quarkus:dev can have the following issues especially after triggering a hot reload.

Recommendations

For better live reload performance please add quarkus.live-reload.instrumentation=true to your application.properties.

Slowness

While running your application in dev mode you might notice it feels slower in certain cases. Things like changing pages in datatables, opening dialogs, and other cases. This is normal, HTTP requests in dev mode are usually slower, but its nothing to worry about, when running in production this does not happen.

PrimeFaces.current().executeScript()

JS code executed from the bean the using PrimeFaces.current().executeScript() runs multiple times - Just like the issue with the <p:dataExporter>, this only happens in dev mode and the amount of times the JS code runs is equal to the amount of times your application was reloaded by Quarkus live reload.

Occasional ViewExpiredException

Occasional "ViewExpiredException: View "page.xhtml" could not be restored" when you make a change to your code that causes Quarkus' live reload feature to reload your application, pages that you have opened on browser will have expired, which is normal and that is what this message means. However, under some rare scenarios (unclear which ones at this point), sometimes right after your application is done being reloaded after you refresh the page you have opened in the browser, you may get this same exception again a few moments later. This doesn't happen very often and the reason behind it is unclear (also does not happen in production)

Occasional java.util.concurrent.RejectedExecutionException

This issue also seems to be rare. But usually happens after a reload is made and you refresh an expired page you have open in the browser. It's unclear what causes it, but refreshing the page again fixes the issue. Since Quarkus' live reload feature only exists in dev mode, this issue doesn't happen in production.

Occasional NullPointerException

NullPointerException: Cannot invoke "javax.enterprise.inject.spi.BeanManager.getBeans(java.lang.reflect.Type, java.lang.annotation.Annotation[])" because "bm" is null at org.apache.myfaces.cdi.util.CDIUtils.get(CDIUtils.java:49) Same as the error above, happens under rare cases after a reload is made and you refresh an expired page you have open in the browser. Refreshing the page again fixes the issue. Since Quarkus' live reload feature only exists in dev mode, this issue doesn't happen in production.