简体   繁体   English

在Eclipse中运行Tomcat并获取“从持久性存储加载异常会话”

[英]Running Tomcat in Eclipse and getting “Exception loading sessions from persistent storage”

I use Eclipse Kepler to develop a Sprig/Hibernate/PostgreSQL-based application. 我使用Eclipse Kepler开发基于Sprig / Hibernate / PostgreSQL的应用程序。 The application is run in Tomcat which is managed by Eclipse. 该应用程序在由Eclipse管理的Tomcat中运行。 This works fine generally. 通常来说,这很好。

After modifying and saving any jsp about 10 times I get the following exception: 修改并保存任何jsp约10次后,出现以下异常:

Jan 17, 2014 9:53:33 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/app] has started
Jan 17, 2014 9:53:33 AM org.apache.catalina.core.ApplicationContext log
INFO: Destroying Spring FrameworkServlet 'dispatcherServlet'
Jan 17, 2014 9:53:33 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
[DEBUG] [ContainerBackgroundProcessor[StandardEngine[Catalina]] 17.01.14 09:53:33] (Utils.java:logSystemState:365) System Info: active sessions:  1, availableProcessors:  8, maxMemory: 1754 MB, totalMemory:  658 MB, freeMemory:  110 MB, loadAverage: 0.11
[DEBUG] [ContainerBackgroundProcessor[StandardEngine[Catalina]] 17.01.14 09:53:33] (LifeCycle.java:destroy:89) APP 1.1.4 (built on Fri, 17.01.2014, 09:55), destroyed at /app, running on target environment 'dev'. Uptime: 1 hour, 4 minutes, 7 seconds and 314 milliseconds. Spring: 3.2.6.RELEASE, Hibernate: 4.2.8.Final
Jan 17, 2014 9:53:33 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/app] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Jan 17, 2014 9:53:36 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 17, 2014 9:53:36 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext

...

Jan 17, 2014 9:53:37 AM org.apache.catalina.session.StandardManager startInternal
SEVERE: Exception loading sessions from persistent storage
java.lang.ClassNotFoundException: com.mycompany.app.spring.AuthenticationWrapper
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at org.apache.catalina.util.CustomObjectInputStream.resolveClass(CustomObjectInputStream.java:76)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1610)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1515)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1913)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1796)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
    at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1595)
    at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1060)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:284)
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:204)
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:491)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3954)
    at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:426)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1345)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
    at java.lang.Thread.run(Thread.java:724)

Jan 17, 2014 9:53:37 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/app] startup failed due to previous errors
Jan 17, 2014 9:53:37 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Jan 17, 2014 9:53:37 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/app] is completed

The only solution to this is to stop Tomcat, do Project->Clean , and restart Tomcat. 唯一的解决方案是停止Tomcat,执行Project->Clean ,然后重新启动Tomcat。 Of course the session is lost and I have to log into the application again. 当然,会话丢失了,我必须再次登录该应用程序。

This problem is seriously affecting my development workflow, and so far I did not find a solution. 这个问题严重影响了我的开发工作流程,到目前为止,我还没有找到解决方案。

Suspecting a filesystem issue, I have tried to create a folder in tmpfs and used it as server path for Tomcat (setting in Eclipse), but it did not change anything. 怀疑有文件系统问题,我试图在tmpfs中创建一个文件夹,并将其用作Tomcat的服务器路径(在Eclipse中进行设置),但是它没有做任何更改。

Note that this is only happening on my laptop (Kubuntu 13.10) A colleague has the same laptop with the same OS and does not see the problem. 请注意,这仅发生在我的笔记本电脑上(Kubuntu 13.10)。某位同事的笔记本电脑具有相同的操作系统,却看不到问题。

It seems the problem is that the session is getting corrupted on the filesystem and Tomcat chokes on that. 似乎问题在于该会话在文件系统上已损坏,并且由此导致Tomcat阻塞。 Why is it happening ? 为什么会这样呢?

One way to make this error go away would be to disable session persistence across restarts. 使该错误消失的一种方法是禁用重新启动之间的会话持久性。 You can do this by editing the file CATALINA_HOME/conf/context.xml and setting the pathname attribute of the <Manager> to an empty string. 您可以通过编辑文件CATALINA_HOME / conf / context.xml并将<Manager>的pathname属性设置为空字符串来执行此操作。

You should also delete any old session.ser files from the CATALINA_HOME/work/Catalina/localhost/<appName> folder whilst Tomcat is shutdown. 在关闭Tomcat的同时,您还应该从CATALINA_HOME / work / Catalina / localhost / <appName>文件夹中删除所有旧的session.ser文件。

This happens may be because Tomcat didn't shutdown cleanly and so session objects got corrupted during serialization. 发生这种情况的原因可能是因为Tomcat没有完全关闭,因此会话对象在序列化过程中被破坏了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM