JSF阶段渲染响应未被调用

时间:2013-02-15 11:34:58

标签: jsf jsf-2 el

在将应用程序从WAS7迁移到Tomcat7的过程中。

我可以部署并启动webapp。我面临的问题是JSF生命周期在执行操作时似乎没有完成。 (不确定是否发生了这种情况,请参阅下面的解释方案)

为了监控生命周期,我编写了一个简单的生命周期代码,并在faces-config.xml

中进行了配置

LifeCycleListener.java

package com.csc.phaseEvent;

import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;

public class LifeCycleListener implements PhaseListener {

    public PhaseId getPhaseId() {
        return PhaseId.ANY_PHASE;
    }

    public void beforePhase(PhaseEvent event) {
        System.out.println("START PHASE " + event.getPhaseId());
    }

    public void afterPhase(PhaseEvent event) {
        System.out.println("END PHASE " + event.getPhaseId());
    }

}

因此,这为每个阶段的控制台StartPhaseEnd Phase提供了输出,但END PHASE INVOKE_APPLICATION 5引用日志后没有任何结果

START PHASE RESTORE_VIEW 1
END PHASE RESTORE_VIEW 1
START PHASE APPLY_REQUEST_VALUES 2
END PHASE APPLY_REQUEST_VALUES 2
START PHASE PROCESS_VALIDATIONS 3
END PHASE PROCESS_VALIDATIONS 3
START PHASE UPDATE_MODEL_VALUES 4
END PHASE UPDATE_MODEL_VALUES 4
START PHASE INVOKE_APPLICATION 5
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:29.984: ServiceDelegator : DEBUG : :Current Process Stack [[openSession.SelectRoleSuccess, coordinatorDesktop.CoordinatorDesktop, openSession.SelectRole]]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:29.985: ServiceDelegator : DEBUG : :Executing Invoke activity [SelectRole]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:29.986: ServiceDelegator : DEBUG : :invoking service action class [SET_ROLE]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:29.992: BaseServiceAction : DEBUG : :SetRole - Session Key used BAC4DB1C-ADDA-4009-4000-96BD19DEA88F/mukul
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:29.993: java.lang.Class : DEBUG : :Executing findUserSession().
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:29.994: java.lang.Class : DEBUG : mukul:Executing persistActiveRoles(UserSession inputUserSession).
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.02: ServiceDelegator : DEBUG : mukul:Current Process Stack [[openSession.SelectRoleSuccess, coordinatorDesktop.CoordinatorDesktop, openSession.SelectRoleSuccess]]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.03: ServiceDelegator : DEBUG : mukul:Executing Invoke activity [SelectRoleSuccess]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.04: ServiceDelegator : DEBUG : mukul:invoking embedded process [coordinatorDesktop]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.05: ServiceDelegator : DEBUG : mukul:Current Process Stack [[openSession.SelectRoleSuccess, coordinatorDesktop.CoordinatorDesktop, openSession.SelectRoleSuccess, coordinatorDesktop.CoordinatorDesktop]]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logXML:260)  - 2013/02/15 16:38:30.06: ServiceDelegator : XML : mukul:process event final result [<process-step-result><outcome>coordinatorDesktop</outcome><result-params><has-errors><![CDATA[false]]></has-errors><error></error><PROCESS_STACK><![CDATA[openSession.SelectRoleSuccess$$coordinatorDesktop.CoordinatorDesktop$$openSession.SelectRoleSuccess$$coordinatorDesktop.CoordinatorDesktop$$]]></PROCESS_STACK><PersistElements><roleID><![CDATA[FullRep]]></roleID></PersistElements><Session><![CDATA[USK:BAC4DB1CADDA4009400096BD19DEA88F/
]]></Session><SelectRoleActionResult><![CDATA[success]]></SelectRoleActionResult><successInd><![CDATA[success]]></successInd><outcome><![CDATA[success]]></outcome></result-params></process-step-result>]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.07: XMLUtils : DEBUG : mukul:node = error  NOT in XML <process-step-result><outcome>coordinatorDesktop</outcome><result-params><has-errors><![CDATA[false]]></has-errors><error></error><PROCESS_STACK><![CDATA[openSession.SelectRoleSuccess$$coordinatorDesktop.CoordinatorDesktop$$openSession.SelectRoleSuccess$$coordinatorDesktop.CoordinatorDesktop$$]]></PROCESS_STACK><PersistElements><roleID><![CDATA[FullRep]]></roleID></PersistElements><Session><![CDATA[USK:BAC4DB1CADDA4009400096BD19DEA88F/
]]></Session><SelectRoleActionResult><![CDATA[success]]></SelectRoleActionResult><successInd><![CDATA[success]]></successInd><outcome><![CDATA[success]]></outcome></result-params></process-step-result>
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.15: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [User] value [mukul]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.16: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [systems] value [[CLIENT-DB, XMLG, CyberLifeWS, Hibernate, CyberLifeWS_VSAM, AWDnative]]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.17: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [ServletURL] value [http://localhost:8080/csa/servlet/Initializer]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.17: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [currSelectionspagecode.authorization.AdminLogon] value [{}]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.18: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [currSelectionspagecode.authorization.Roles] value [{rowTable= FullRep}]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.19: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [PROCESS_STACK] value [openSession.SelectRoleSuccess$$coordinatorDesktop.CoordinatorDesktop$$openSession.SelectRoleSuccess$$coordinatorDesktop.CoordinatorDesktop$$]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.20: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [Session] value [USK%3ABAC4DB1CADDA4009400096BD19DEA88F%2F%0C%14%0A%14%0B]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.20: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [prevSelectionspagecode.authorization.AdminLogon] value [{}]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.21: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [roles] value [[Manager, FullRep, PolAdminRep, loaderRunner, Agent, CustomerService.Level1Analyst, PolOwnerService.Level1Analyst, Approver, AgentFull, OfflineUser, PolOwnerService.ReadOnly]]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.22: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [authToken] value [mukul]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.22: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [roleID] value [FullRep]
  DEBUG [http-bio-8080-exec-1] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 16:38:30.23: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [prevSelectionspagecode.authorization.Roles] value [{rowTable=[ FullRep]}]
END PHASE INVOKE_APPLICATION 5

没有任何反应,控制台没有错误消息。浏览器窗口显示其加载但没有加载。

此应用在WAS上运行良好。

任何帮助都会受到赞赏,这种行为的可能原因是什么?

不确定可能需要哪些其他信息,请询问您是否需要任何信息。

更新#1

根据maple_shaft尝试添加immediate = "true"

以下是堆栈跟踪

START PHASE RESTORE_VIEW 1
END PHASE RESTORE_VIEW 1
START PHASE APPLY_REQUEST_VALUES 2
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.410: ServiceDelegator : DEBUG : :Current Process Stack [[openSession.SelectRole]]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.411: ServiceDelegator : DEBUG : :Executing Invoke activity [SelectRole]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.411: ServiceDelegator : DEBUG : :invoking service action class [SET_ROLE]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.415: BaseServiceAction : DEBUG : :SetRole - Session Key used B9DB051D-8BF4-472D-4000-94BFA0965A49/mukul
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.415: java.lang.Class : DEBUG : :Executing findUserSession().
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.415: java.lang.Class : DEBUG : mukul:Executing persistActiveRoles(UserSession inputUserSession).
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.418: ServiceDelegator : DEBUG : mukul:Current Process Stack [[openSession.SelectRoleSuccess]]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.418: ServiceDelegator : DEBUG : mukul:Executing Invoke activity [SelectRoleSuccess]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.418: ServiceDelegator : DEBUG : mukul:invoking embedded process [coordinatorDesktop]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.418: ServiceDelegator : DEBUG : mukul:Current Process Stack [[openSession.SelectRoleSuccess, coordinatorDesktop.CoordinatorDesktop]]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logXML:260)  - 2013/02/15 18:41:27.418: ServiceDelegator : XML : mukul:process event final result [<process-step-result><outcome>coordinatorDesktop</outcome><result-params><has-errors><![CDATA[false]]></has-errors><error></error><PROCESS_STACK><![CDATA[openSession.SelectRoleSuccess$$coordinatorDesktop.CoordinatorDesktop$$]]></PROCESS_STACK><PersistElements><roleID><![CDATA[FullRep]]></roleID></PersistElements><Session><![CDATA[USK:B9DB051D8BF4472D400094BFA0965A49/
]]></Session><SelectRoleActionResult><![CDATA[success]]></SelectRoleActionResult><successInd><![CDATA[success]]></successInd><outcome><![CDATA[success]]></outcome></result-params></process-step-result>]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.418: XMLUtils : DEBUG : mukul:node = error  NOT in XML <process-step-result><outcome>coordinatorDesktop</outcome><result-params><has-errors><![CDATA[false]]></has-errors><error></error><PROCESS_STACK><![CDATA[openSession.SelectRoleSuccess$$coordinatorDesktop.CoordinatorDesktop$$]]></PROCESS_STACK><PersistElements><roleID><![CDATA[FullRep]]></roleID></PersistElements><Session><![CDATA[USK:B9DB051D8BF4472D400094BFA0965A49/
]]></Session><SelectRoleActionResult><![CDATA[success]]></SelectRoleActionResult><successInd><![CDATA[success]]></successInd><outcome><![CDATA[success]]></outcome></result-params></process-step-result>
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.420: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [systems] value [[CLIENT-DB, XMLG, CyberLifeWS, Hibernate, CyberLifeWS_VSAM, AWDnative]]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.420: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [User] value [mukul]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.420: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [ServletURL] value [http://localhost:8080/csa/servlet/Initializer]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.420: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [currSelectionspagecode.authorization.AdminLogon] value [{}]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.421: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [currSelectionspagecode.authorization.Roles] value [{rowTable= FullRep}]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.421: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [PROCESS_STACK] value [openSession.SelectRoleSuccess$$coordinatorDesktop.CoordinatorDesktop$$]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.421: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [Session] value [USK%3AB9DB051D8BF4472D400094BFA0965A49%2F%0C%14%0A%14%0B]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.421: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [roles] value [[Manager, FullRep, PolAdminRep, loaderRunner, Agent, CustomerService.Level1Analyst, PolOwnerService.Level1Analyst, Approver, AgentFull, OfflineUser, PolOwnerService.ReadOnly]]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.421: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [prevSelectionspagecode.authorization.AdminLogon] value [{}]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.421: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [authToken] value [mukul]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.421: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [prevSelectionspagecode.authorization.Roles] value [{rowTable=[ FullRep]}]
  DEBUG [http-bio-8080-exec-2] (com.csc.fs.logging.Log4JHandler:logDebug:145)  - 2013/02/15 18:41:27.421: pagecode.authorization.Roles : DEBUG : mukul:Persisted element [roleID] value [FullRep]
END PHASE APPLY_REQUEST_VALUES 2

更新#2:@BalusC建议的调试步骤

我在FacesServlet#service()的第594行放置了一个断点,控件确实停在此处。 踩到它后,控件转到LifecycleImpl#render()第128行。有if个分支,其中没有一个被评估为真,控件返回FacesServlet#service()finally阻止行612,然后调用requestEnd()

更新#3:

由于在FacesContext#responseComplete()阶段被调用Invoke_Application。 这是从ExternalContextImpl#redirect()行号#578调用的。在redirect() else子句中,即执行((HttpServletResponse) response).sendRedirect(requestURI);

1 个答案:

答案 0 :(得分:0)

现在问题与JSF无关,但在web.xml中配置了安全约束。

约束不允许访问任何页面,因此浏览器卡住了。

但非常感谢 Bauke Scholtz 的帮助