Olá pessoal estou tentando fazer uma aplicação com MyFaces e Hibernate, inicialmente fiz uma pagina de cadastro de unidade…
mas ocorre um erro no momento de startar a aplicação …O erro é o seguinte:
exception
javax.servlet.ServletException: Servlet.init() for servlet Faces Servlet threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Unknown Source)
[b]
root cause
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
org.apache.myfaces.webapp.StartupServletContextListener
javax.faces.FactoryFinder.getFactory(FactoryFinder.java:103)
javax.faces.webapp.FacesServlet.init(FacesServlet.java:102)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Unknown Source)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.
[/b]
A Classe e o respectivo método que estou usando para salvar é esse:
[b]package br.com.siscom.controller;
import org.hibernate.Session;
import br.com.siscom.model.bean.Unidade;
import br.com.siscom.model.dao.HibernateDAO;
import br.com.siscom.model.dao.InterfaceDAO;
import br.com.siscom.util.FacesContextUtil;
public class UnidadeBean {
private Unidade unidade = new Unidade();
public String salvarUnidade()
{
Session session = FacesContextUtil.getRequestSession();
InterfaceDAO unidadeDAO = new HibernateDAO(Unidade.class, session);
Unidade unidade = new Unidade();
unidadeDAO.salvar(unidade);
return null;
}
public void setUnidade(Unidade unidade) {
this.unidade = unidade;
}
public Unidade getUnidade() {
return unidade;
}
}[/b]
Séra que pode ser um erro no método??? É estranho porque fiz um metodo de busca e funcionou normalmente…
Declarei ele assim no faces-config.xml:
unidadeBean
br.com.siscom.controller.UnidadeBean
session
Por favor se alguem poder me ajudar eu agradeço muito!!