jsf2-没有调用jsf阶段的Render Response



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

我可以部署并启动网络应用程序。我面临的问题是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);执行

现在问题与JSF无关,而是与web.xml中配置的安全约束有关。

一个限制是不允许访问任何页面,因此浏览器被卡住了。

但是非常感谢Bauke-Scholtz

的帮助

相关内容

  • 没有找到相关文章

最新更新