我使用Eclipse Kepler开发基于Sprig / Hibernate / PostgreSQL的应用程序。该应用程序在由Eclipse管理的Tomcat中运行。这通常很好。
修改并保存任何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
唯一的解决方案是停止Tomcat,执行Project->Clean
,然后重启Tomcat。当然会话丢失了,我必须再次登录应用程序。
这个问题严重影响了我的开发工作流程,到目前为止我还没有找到解决方案。
怀疑文件系统问题,我尝试在tmpfs中创建一个文件夹并将其用作Tomcat的服务器路径(在Eclipse中设置),但它没有改变任何内容。
请注意,这只发生在我的笔记本电脑上(Kubuntu 13.10)一位同事拥有相同操作系统的同一台笔记本电脑,但没有看到问题。
似乎问题是会话在文件系统上被破坏而Tomcat会对此产生阻塞。为什么会这样?
答案 0 :(得分:3)
使此错误消失的一种方法是在重新启动时禁用会话持久性。您可以通过编辑文件 CATALINA_HOME / conf / context.xml 并将<Manager>
的pathname属性设置为空字符串来完成此操作。
当Tomcat关闭时,您还应该从 CATALINA_HOME / work / Catalina / localhost /&lt; appName&gt; 文件夹中删除任何旧的 session.ser 文件。
这可能是因为Tomcat没有干净地关闭,因此会话对象在序列化过程中被破坏。