jsfcdimojarrapropertynotfoundexceptionjsf-2.3

CDI managed bean in Mojarra 2.3 throws PropertyNotFoundException, Target Unreachable, identifier 'localeBean' resolved to null


I have problem with bean discovery in JSF 2.3 and CDI application. I am using Glassfish 5.0, Java 8 (1.8.0_151). My files:

faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
              version="2.3">


</faces-config>

LocaleBean:

import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

@Named
@SessionScoped
public class LocaleBean implements Serializable {

}

Message in Glassfish log after submitting a form to this bean:

javax.el.PropertyNotFoundException: /home.xhtml @15,81 value="#{localeBean.language}": Target Unreachable, identifier 'localeBean' resolved to null

Form submit works only if I use imports listed bellow instead of @Named and @SessionScoped from javax.enterprise.context package.

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

But both are deprecated in JSF 2.3.

Any ideas guys? Thank you!


Solution

  • I have found solution and its description in this topic on GitHub:

    https://github.com/javaserverfaces/mojarra/issues/4264