Olá amigos
alguém poderia me ajudar com este erro:
17/07/2010 19:27:32 com.sun.faces.lifecycle.ProcessValidationsPhase execute
WARNING: /pages/login.xhtml @27,87 value="#{loginBean.usuario.login}": Target Unreachable, identifier ‘loginBean’ resolved to null
javax.el.PropertyNotFoundException: /pages/login.xhtml @27,87 value="#{loginBean.usuario.login}": Target Unreachable, identifier ‘loginBean’ resolved to null
at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1008)
at javax.faces.component.UIInput.validate(UIInput.java:934)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1189)
at javax.faces.component.UIInput.processValidators(UIInput.java:691)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1080)
at javax.faces.component.UIForm.processValidators(UIForm.java:243)
at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:439)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:455)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at br.gov.pb.mp.sistemabase.view.filter.AbstractFilter.goToPage(AbstractFilter.java:46)
at fesp.view.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:28)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
faces-config.xml:
<?xml version="1.0"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<application>
<!-- diz para o JSF usar o framework Spring -->
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
<!-- diz para o JSF usar o Facelets -->
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
<locale-config>
<default-locale>pt_BR</default-locale>
</locale-config>
<message-bundle>
messages.ApplicationResources
</message-bundle>
</application>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>page.home</from-outcome>
<to-view-id>/pages/home.jsf</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>page.goto-system</from-outcome>
<to-view-id>/pages/redirect/goto_system.jsf</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>page.login</from-outcome>
<to-view-id>/pages/login.jsf</to-view-id>
</navigation-case>
</navigation-rule>
<!-- Regras de Navegação -->
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>page.manter_contribuinte</from-outcome>
<to-view-id>/pages/contribuinte/manter_contribuinte.jsf</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-action>#{contribuinteMBean.manter}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/pages/contribuinte/manter_contribuinte.jsf</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
login.xhtml
<h:outputLabel for="username" value="Login da rede: " />
<h:inputText id="username" value="#{loginBean.usuario.login}" required="true" />
<h:outputLabel for="senha" value="Senha: "/>
<h:inputSecret id="senha" value="#{loginBean.usuario.password}" required="true" />
<f:facet name="footer">
<h:panelGroup style="display:block; text-align:right">
<h:commandButton action="#{loginBean.login}" value="Entrar"/>
</h:panelGroup>
</f:facet>
loginMBean.java:
package fesp.view.backingbean;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import br.gov.pb.mp.framework.persistence.exception.ValidationException;
import br.gov.pb.mp.sistemabase.model.entities.Usuario;
import br.gov.pb.mp.sistemabase.model.service.IControleAcesso;
import br.gov.pb.mp.sistemabase.model.service.impl.LogonServidorImpl;
import br.gov.pb.mp.sistemabase.view.backingbean.AbstractBackingBean;
@Controller
@Scope("request")
public class LoginBean extends AbstractBackingBean {
private static final long serialVersionUID = -4267126937033547021L;
private Usuario usuario = new Usuario();
@Autowired
private IControleAcesso controleAcessoService;
public String login() throws ClassNotFoundException, SQLException{
String url = null;
String user = null;
String password = null;
String driver = null;
String sql = null;
PreparedStatement stmt = null;
ResultSet rs;
Properties p = new Properties();
try {
InputStream con = Thread.currentThread().getContextClassLoader().getResourceAsStream("hibernate.properties");
p.load(con);
} catch (IOException ex) {
ex.printStackTrace();
}
url = p.getProperty("hibernate.connection.url");
user = p.getProperty("hibernate.connection.username");
password = p.getProperty("hibernate.connection.password");
driver = p.getProperty("hibernate.connection.driver_class");
Class.forName(driver);
Connection conn = DriverManager.getConnection(url, user, password);
try {
sql = "select * from users where username = ? and password = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1,usuario.getLogin().toUpperCase());
stmt.setString(2,usuario.getPassword());
rs = stmt.executeQuery();
if (rs.next()) {
LogonServidorImpl logon = new LogonServidorImpl();
usuario.setPassword(null);
logon.setUsuario(usuario);
super.putAutorizacao(logon);
return "page.home";
}
else {
throw new ValidationException("error.wssca.usuario.authentication.error");
}
} catch (Exception e) {
super.addException(e);
removeAutorizacao();
return null;
}
}
public String logout(){
try {
controleAcessoService.logout(super.getLogon());
} catch (Exception e) {
this.removeAutorizacao();
return "page.login";
}
this.removeAutorizacao();
return "page.login";
}
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
}
Muito obrigado
Silvio Guedes