У меня есть приложение maven с Eclipse Mars, JSF 1.2, RichFaces 3.3.3, Hibernate 3.2.0, Java 1.7, которое при попытке публикации в glassfish 4.1.2 выдает следующую ошибку:
Exception while invoking class com.sun.enterprise.web.WebApplication start method
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: Can not create Lifecycle for ID: com.sun.faces.lifecycle.PARTIAL.
...
Exception during lifecycle processing
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: Can not create Lifecycle for ID: com.sun.faces.lifecycle.PARTIAL
после того, как я сделал maven: очистить и попытаться переиздать приложение выдало следующую ошибку:
WebModule[/CA-Client]Servlet Faces Servlet threw unload() exception
javax.servlet.ServletException: Servlet.destroy() for servlet Faces Servlet threw exception
....
Caused by: java.lang.NullPointerException
at javax.faces.webapp.FacesServlet.uninitHttpMethodValidityVerification(FacesServlet.java:511)
...
Critical error during deployment:
com.sun.faces.config.ConfigurationException:
Source Document: jndi:/server/CA-Client/WEB-INF/faces-config.xml
Cause: Unable to create a new instance of 'caclient.listener.CtrPhaseListener': javax.faces.FacesException: caclient.listener.CtrPhaseListener
мой faces.config равен
<lifecycle>
<phase-listener>caclient.listener.CtrPhaseListener</phase-listener>
</lifecycle>
мой класс слушателя:
src/main/java/caclient.listener.CtrPhaseListener.java
myface-config:
src/main/java/webapp/WEB-INF/faces.config.xml
my CtrPhaseListener.class
public class CtrPhaseListener implements PhaseListener {
private static final String PASSED_PAGES = "/Login.jsp, /AlterarSenha.jsp";
private Date ultimoAcesso = null;
public void afterPhase(PhaseEvent event) {}
public void beforePhase(PhaseEvent event) {
FacesContext ctx = event.getFacesContext();
String paginaDestino = ctx.getViewRoot().getViewId();
ctx = event.getFacesContext();
HttpSession session = (HttpSession) ctx.getExternalContext().getSession(false);
ultimoAcesso = (ultimoAcesso == null) ? new Date() : ultimoAcesso;
SimpleDateFormat sdf = new SimpleDateFormat("HHmm");
int mins = Integer.parseInt(sdf.format(new Date())) - Integer.parseInt(sdf.format(ultimoAcesso));
if (/*mins > 10 || */session == null || session.getAttribute("sessionUser") == null) {
if (!PASSED_PAGES.contains(paginaDestino) && paginaDestino.contains(".jsp")) {
try {
//se não existir direciona para a página de LOGIN
ultimoAcesso = null;
session.setAttribute("sessionUser", null);
ctx.getExternalContext().redirect("faces/Login.jsp");
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
ultimoAcesso = new Date();
}
public PhaseId getPhaseId() {
return PhaseId.APPLY_REQUEST_VALUES;
}
}
Проблема связана с папкой "src / main / java", которая быласозданный Maven?