seam-faces + @Viewscope = nullpointerException
rafael_jesus May 30, 2012 2:29 AMHello guys,
Im facing a big problem with seam, when i use @Viewscope in my bean i get nullpointer when accessing him, and i have no ideia what it could it be,
Im using the seam faces and api 3.1.0.Final, jsf verision is 2.1.8, i need to to delivery a software 2morrow and im stuck in this trouble..
Here is a isolated example of my code:
PS: In debugin mode the login and password values are setten, but when they go to the userService.withLogin(null, null)
I´ve testes in various pages of my, i just post this plain one to get easier...
pom.xml
<dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-impl</artifactId> <version>${jsf.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.sun.faces</groupId> <artifactId>jsf-api</artifactId> <version>${jsf.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.seam.faces</groupId> <artifactId>seam-faces-api</artifactId> <version>${seam.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.seam.faces</groupId> <artifactId>seam-faces</artifactId> <version>${seam.version}</version> <scope>provided</scope> </dependency>
login.xhtml
LoginMB:
@Named @ViewScoped public class UserMb extends BaseBean implements Serializable { @Inject private UserService userService; private User user = new User(); private String login; private String password; public String userLogin () { try { user = userService.withLogin(login, password); return Const.PRINCIPAL; } catch ( NoResultException nre ) { nre.printStackTrace(); addErrorMessage("user not found"); return ""; } catch ( Exception e ) { e.getCause().getLocalizedMessage(); addErrorMessage("unexcepted error has ocurred"); return ""; } } // gets and sets private static final long serialVersionUID = -3651540800634544658L; }
An help will be welcome,
Tks,
Rafael Jesus