Pergunta

Hi I'm having a problem with Openshift. The error is:

javax.el.PropertyNotFoundException: Target Unreachable, identifier 'loginController' resolved to null

On my Tomcat7 and Glassfish it works fine. I'm using JSF 2.0 with Primefaces 4 and CDI Weld. Here is my code:

My pojo

public class Login {
    private int codigo;
    private String username;
    private String password;
    // getters and setters
}

My controller

import javax.enterprise.context.SessionScoped;    
import javax.inject.Inject;
import javax.inject.Named;
//others imports

@Named
@SessionScoped
public class LoginController implements Serializable {    
    private static final long serialVersionUID = 4560576357452534579L;    
    @Inject
    private LoginDAO loginDao;        
    private Login login;

    // others fields        
    // getters and setters of Login    
}

My JSF page

<p:inputText class="form-control" id="username" value="#{loginController.login.username}" />
<p:password class="form-control" id="password" value="#{loginController.login.password}" />

Nenhuma solução correta

Outras dicas

You're injecting loginDao but not login. Yet you're referencing login. Unless you're initializing login somewhere else, you're going to get a NPE.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top