0

重複の可能性:
JSF1.2例外処理

web.xmlには、次のようにsession-configがあります。

<session-config>
  <session-timeout>2</session-timeout>
</session-config>   

また、次のように定義されたエラーページがあります

<error-page>
    <exception-type>javax.faces.application.ViewExpiredException</exception-type>
    <location>/sc00/ErrorPage.jsp</location>
 </error-page>

アプリケーションがタイムアウトすると、エラーページに移動できず、

SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.


Original Exception: 
Error Message: javax.servlet.ServletException: /sc40/NewContract.facesNo saved         view      state could be found for the view identifier: /sc40/NewContract.faces
Error Code: 500
Target Servlet: Faces Servlet
Error Stack: 
javax.faces.application.ViewExpiredException: /sc40/NewContract.facesNo saved view     state could be found for the view identifier: /sc40/NewContract.faces 
 at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128) 
 at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171) 
 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) 
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189) 
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1147) 
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:722) 
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449) 
 at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) 
 at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1020) 
 at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3639) 
 at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) 
 at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:950) 
 at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659) 
 at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) 
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452) 
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511) 
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305) 
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276) 
 at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) 
 at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) 
 at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) 
 at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
 at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
 at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
 at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
 at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
 at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648) 




Error Page Exception: 
Error Message: java.lang.RuntimeException: FacesContext not found
Error Code: 0
Target Servlet: 
Error Stack: 
java.lang.RuntimeException: FacesContext not found 
 at javax.faces.webapp.UIComponentClassicTagBase.getFacesContext (UIComponentClassicTagBase.java:324) 
 at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:226) 
 at com.ibm._jsp._ErrorPage._jspx_meth_f_view_0(_ErrorPage.java:416) 
 at com.ibm._jsp._ErrorPage._jspService(_ErrorPage.java:103) 
 at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99) 
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) 
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1147) 
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:722) 
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449) 
 at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) 
 at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122) 
 at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:205) 
 at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1020) 
 at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1382) 
 at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:191) 
 at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3143) 
 at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:3669) 
 at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3650) 
 at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) 
 at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:950) 
 at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659) 
 at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) 
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452) 
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511) 
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305) 
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276) 
 at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) 
 at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) 
 at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) 
 at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
 at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
 at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
 at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
 at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
 at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648) 
                                                                                        and i am using jsf1.2

例外をerrorpage.jspに送信するにはどうすればよいですか。ブラウザをシャットダウンして再起動する必要があるため、タイムアウト例外をjsfで処理したくありません。したがって、この例外を処理する方法を提案してください。私はjsf1.2を使用しています。

4

1 に答える 1

0

何らかの理由で、上記のタグが web.xml で機能していません。理由を突き止めようとしましたが、できませんでした。

問題を解決するために、次のようにリスナークラスを作成し、「Facesconfig.xml」にリスナークラスを登録しました

 <lifecycle>
<phase-listener>com.bcbsks.me.sc00.listeners.ErrorPageNavigationListener</phase-  listener>
</lifecycle> 

ここで、「ErrorPageNAvigationListener」は Listener クラスであり、Listener クラス内のコードは次のとおりです。

public class ErrorPageNavigationListener implements PhaseListener{

/**
 * 
 */
private static final long serialVersionUID = 1L;

String HOME_PAGE = "../sc00/TimeOutPage.faces";

@Override
public void afterPhase(PhaseEvent event) {
    FacesContext facesContext = event.getFacesContext();
     if(facesContext.getViewRoot()==null){   
       try{   
           facesContext.getExternalContext().redirect(HOME_PAGE);                   
           facesContext.responseComplete(); 

         } catch (IOException e){   
           e.printStackTrace();   
       } 
     }
}

@Override
public void beforePhase(PhaseEvent event) {
    // TODO Auto-generated method stub

}

@Override
public PhaseId getPhaseId() {
    // TODO Auto-generated method stub
    return PhaseId.RESTORE_VIEW;

}   
}

HOME_PAGE はエラーページへのパスであり、私にとってはうまく機能します。

于 2012-11-11T20:53:28.590 に答える