Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Target Unreachable, identifier resolved to null in JSF 2.2 [duplicate]

I have a problem with JSF 2.2 and CDI, my managerbean is not solved and this error appear

"value="#{userBean.user.name}": Target Unreachable, identifier 'userBean' resolved to null"

This is my manager bean.

@ManagedBean
@RequestScoped
public class UserBean implements Serializable {
    private User user;

    public void setUser(user) {
        this.user = user;
    }
    ...
}

My view is:

<h:form id="login-form">
    <h:outputText value="User"/>
    <h:inputText value="#{userBean.user.name}" id="username"/>

    <h:outputText value="Senha"/>
    <h:inputSecret value="#{userBean.user.password}" id="pasword"/>

    <h:commandButton id="button" value="Login" action="#{userBean.login}"/>

    <h:messages />
</h:form>
like image 521
SaXeTz Avatar asked Dec 10 '13 20:12

SaXeTz


2 Answers

I want to share my experience with this Exception. My JSF 2.2 application worked fine with WildFly 8.0, but one time, when I started server, i got this "Target Unreacheable" exception. Actually, there was no problem with JSF annotations or tags.

Only thing I had to do was cleaning the project. After this operation, my app is working fine again.

I hope this will help someone!

like image 101
akelec Avatar answered Sep 19 '22 16:09

akelec


  1. You need

    @ManagedBean(name="userBean")

  2. Make sure you have getUser() method.

  3. Type of setUser() method should be void.

  4. Make sure that User class has proper setters and getters as well.

like image 45
PM 77-1 Avatar answered Sep 19 '22 16:09

PM 77-1