来自持久存储的异常加载会话,已扩展

时间:2017-08-25 15:05:41

标签: java tomcat7 ubuntu-16.04

我得到了

Aug 25, 2017 3:35:42 PM org.apache.catalina.session.StandardManager startInternal
SCHWERWIEGEND: Exception loading sessions from persistent storage
java.lang.ClassCastException: java.lang.String cannot be cast to java.io.ObjectStreamClass
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1511)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1997)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1921)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
        at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1608)
        at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1074)
        at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:259)
        at org.apache.catalina.session.StandardManager.load(StandardManager.java:176)
        at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:465)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5593)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

((HttpSession) getContextProperty("Session")).setAttribute(name, value);

引发

Fri Aug 25 15:35:47 GMT+01:00 2017
Server Exception. ID: 72acb94e_15e19d20417_12
java.lang.NullPointerException
        at de.supportgis.gdi.gdigui.GDIApplication.setSessionAttribute(GDIApplication.java:187)
        at de.supportgis.gdi.gdigui.GDIApplication.setCurrentUserLocale(GDIApplication.java:156)
        at de.supportgis.gdi.gdigui.components.StandardContentPanel.getLS(StandardContentPanel.java:236)
        at de.supportgis.gdi.gdigui.content.Login.<init>(Login.java:68)
        at de.supportgis.gdi.gdigui.GDIApplication.init(GDIApplication.java:62)
        at nextapp.echo.app.ApplicationInstance.doInit(ApplicationInstance.java:288)
        at nextapp.echo.webcontainer.UserInstance.prepareApplicationInstance(UserInstance.java:484)
        at nextapp.echo.webcontainer.ComponentInputProcessor.process(ComponentInputProcessor.java:160)
        at nextapp.echo.webcontainer.ClientMessage.process(ClientMessage.java:194)
        at nextapp.echo.webcontainer.InputProcessor.process(InputProcessor.java:163)
        at nextapp.echo.webcontainer.Synchronization.process(Synchronization.java:121)
        at nextapp.echo.webcontainer.service.SynchronizeService.service(SynchronizeService.java:78)
        at nextapp.echo.webcontainer.WebContainerServlet.process(WebContainerServlet.java:432)
        at de.supportgis.gdi.gdigui.StartServlet.process(StartServlet.java:37)
        at nextapp.echo.webcontainer.WebContainerServlet.doPost(WebContainerServlet.java:316)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:221)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

我想这并不重复,因为我检查并应用exception loading sessions from persistent storage中的每个答案都没有运气,例如:

  • 删除/var/cache/tomcat7/Catalina/localhost/gdi/SESSIONS.ser(如果Tomcat停止,则无论如何都不存在)。

我没有破坏的符号链接:

find / -xtype l 2>/dev/null

没有任何相关内容。

我猜这是来自apt dist-upgrade的文件系统权限问题。我真的必须重新安装漏洞服务器吗?

1 个答案:

答案 0 :(得分:1)

方法GDIApplication.setSessionAttribute(第二个堆栈跟踪)调用导致NPE的getContextProperty("Session")

方法ApplicationInstance.getContextProperty("Session")属于Echo Framework(https://github.com/echo3/echo3)。我不确定如何获取Session对象,但第一个堆栈跟踪中的ClassCastException可能会干扰它。

尝试替换

((HttpSession) getContextProperty("Session")).setAttribute(name, value);

Connection conn = WebContainerServlet.getActiveConnection();
conn.getRequest().getSession().setAttribute(name, value);

这使您可以访问当前的ServletRequest,并允许您使用Java的ServletRequest.getSession()方法检索会话,如果该会话尚不存在,将创建该会话。

至于会话娱乐期间的ClassCastException:我不知道你已经尝试过的任何其他方式。但如果上述提示有效,这些例外可能仍然令人讨厌,但可能会变得无害。我承认,当他们出现时我通常会忽略它们......