1 Reply Latest reply on Mar 16, 2016 11:50 AM by David Gómez

    facesContext null when deploying in Wildfly 10

    David Gómez Newbie



      We have an app deployed as an EAR in Wildfly 10, inside there's a WAR and some JARs (with EJBs), because the way it is built, we have some JSF backing beans (and some faces-config.xml) deployed inside de JARs, however, when we try to use the facesContext it returns null always (FacesContext.getCurrentInstance();). It was working very well until JBoss 7.1, we use myfaces 2.1 and tomahawk 1.1.10. Maybe is there something important to take into account when we deploy backing beans this way? there aren't issues written in the log file.


      The JSF subsystem is in standalone.xml this way: <subsystem xmlns="urn:jboss:domain:jsf:1.0" default-jsf-impl-slot="myfaces-2.1.12"/>. We installed it using a module installer provided by wildfly for myFaces and we get sure that there are not conflicts with other possible deployments/modules.


      Also, in the log we see this: "INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [myfaces-2.1.12, main]"


      Any help or idea could we useful.


      Thanks in advance!



        • 1. Re: facesContext null when deploying in Wildfly 10
          David Gómez Newbie



          In case someone is interested, we found a solution for this. Sadly we couldn't make it work with myfaces-2.1.12, we just unistalled it to prove the native installation of Wildfly (we tried to use MyFaces because we used it from the very beginning of the project), however it wasn't a complete solution because we have this kind of context: http://ipaddress:8080/myApp/faces/views/homepage.xhtml and with this JSF implementation, it works without the /faces part which raises other issues to us.


          What we finally did was to replace the native JSF implementation of Wildfly 10 with Mojarra:


          * Uninstall MyFaces (with uninstaller or manually)

          * Modify standalone.xml to use the default implementation, it must be like this: <subsystem xmlns="urn:jboss:domain:jsf:1.0"/>

          * Change the API Jar in $WILDFLY_HOME/modules/system/layers/base/javax/faces/api/main with jsf-api-2.2.13.jar (Mojarra) and update module.xml to reference it

          * Change the IMPL Jar in $WILDFLY_HOME/modules/system/layers/base/com/sun/jsf-impl/main with jsf-impl-2.2.13.jar (Mojarra) and update module.xml to reference it

          * Restart Wildfly and that's it!


          Hope it helps someone!