我面臨一個奇怪的問題,我無法找出根本原因。這是問題陳述。Tapestry5註銷異常
我有一個帶註銷按鈕的掛毯頁面。當我點擊註銷按鈕時,下面的代碼被執行,我得到異常。
// method which called onclick of logout button.
@OnEvent(value = EventConstants.ACTION, component = "tlogout")
public Object logout()
{
request.getSession(false).invalidate();
return "Login";
}
的例外是:
INFO | net.awl.tapestry5.kawwa.services.KawwaModule.TabLocator | 2011-01-05 14:33:23,321
> Checking for any UPDATES
INFO | net.awl.bfi.websuite.services.AppModule.TimingFilter | 2011-01-05 14:33:23,352
> Request time: 31 ms
ERROR | org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/WebSuiteMoreaTapestry].[default] | 2011-01-05 14:33:23,352
> Servlet.service() for servlet default threw exception
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2221)
at org.apache.catalina.connector.Request.getSession(Request.java:2031)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:832)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:843)
at net.atos.xa.rm.jaas.openejb.web.RMOpenEJBFilter.doFilter(RMOpenEJBFilter.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.openejb.tomcat.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
傢伙什麼想法? Regards,
Mahendra
當你的方法不會出現在堆棧跟蹤,似乎執行罰款,但'net.atos.xa.rm.jaas.openejb.web.RMOpenEJBFilter'試圖使用/後創建一個會話你已經失效了,失敗了。 異常是否發生在與註銷相同的請求上,還是在重定向到登錄頁面之後發生? – Henning 2011-01-05 16:03:52
Henning我認爲它是與註銷相同的請求。因爲我試圖把system.out.print放在Login頁面的@SetupRender方法中,但是它沒有在控制檯上打印任何東西。接下來的一點是,我檢查了
net.atos.xa.rm.jaas.openejb.web.RMOpenEJBFilter
doFilter方法,發現它從會話中獲得了一些屬性,這就是爲什麼我得到錯誤。但它是一個過濾器,所以它將在每個請求/響應之後被調用。這是否意味着我無法使會話無效? – 2011-01-05 18:08:38過濾器可以在請求處理之前或之後完成它的工作。也許你需要通知openejb會話失效。我會看看它的源代碼,文檔等。我不認爲這是一個掛毯問題。標記openejb人有想法。 – pstanton 2011-01-05 21:52:42