在使会话无效时,websphere中出现IllegalStateException

时间:2013-09-20 16:43:34

标签: jsp session websphere-7 illegalstateexception invalidation

我希望在加载jsp时使会话无效,以便从jsp中删除任何现有的会话属性,这些jsp指向此jsp.Below代码正在处理tomcat6.0.29但在websphere7.0.19中抛出java.lang.IllegalStateException 。我尝试添加一些'if'条件但是在调用invalidate时会抛出错误。

<%
      try {                 
                if(request.getSession().getAttribute("userId") != null)
                {

                    if (!request.getSession().isNew()) {
                        request.getSession().invalidate();
                    }
                }
                } catch (Exception ex) {System.out.println("catch");
                }
 %>

错误消息

00000032  E UOW=null source=com.ibm.ws.webcontainer.servlet class=com.ibm.ws.webcontainer.servlet.ServletWrapper method=service org=null prod=null component=null thread=[WebContainer : 7]
      SRVE0068E: Uncaught exception created in one of the service methods of the servlet /jsp/login.jsp in application xxxxxxxx. Exception created : java.lang.IllegalStateException
at com.ibm.ws.session.http.HttpSessionImpl.getAttribute(HttpSessionImpl.java:191)
at com.ibm.ws.session.SessionData.getSessionValue(SessionData.java:306)
at com.ibm.ws.session.SessionData.getAttribute(SessionData.java:162)
at com.ibm.ws.session.HttpSessionFacade.getAttribute(HttpSessionFacade.java:139)
at org.apache.jasper.runtime.PageContextImpl.findAttribute(PageContextImpl.java:435)
at javax.servlet.jsp.el.ScopedAttributeELResolver.getValue(ScopedAttributeELResolver.java:89)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
at org.apache.el.parser.AstEmpty.getValue(AstEmpty.java:29)
at org.apache.el.parser.AstNot.getValue(AstNot.java:26)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:263)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:774)
at com.ibm._jsp._login._jspx_meth_c_if_0(_login.java:191)
at com.ibm._jsp._login._jspService(_login.java:163)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:104)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:259)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:354)
at com.ibm.ws.webcontainer.servlet.FilterProxyServlet.dispatch(FilterProxyServlet.java:88)
at com.ibm.ws.webcontainer.servlet.FilterProxyServlet.service(FilterProxyServlet.java:62)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:997)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:1062)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:759)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3935)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
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.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
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:1604)

已解决问题 - 我们已通过添加&lt;%@ page session =“false”%&gt;来解决此问题在JSP中并在两个JSP中显式定义会话 session.invalidate() not working in Websphere Application Server

try {   

                HttpSession session = request.getSession();

                if(session!=null)
                {session.invalidate();}
                } catch (Exception ex) {
                }

0 个答案:

没有答案