0

I use Eclipse Kepler to develop a Sprig/Hibernate/PostgreSQL-based application. The application is run in Tomcat which is managed by Eclipse. This works fine generally.

After modifying and saving any jsp about 10 times I get the following exception:

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. 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.

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.

It seems the problem is that the session is getting corrupted on the filesystem and Tomcat chokes on that. Why is it happening ?

yglodt
  • 13,807
  • 14
  • 91
  • 127

1 Answers1

3

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.

You should also delete any old session.ser files from the CATALINA_HOME/work/Catalina/localhost/<appName> folder whilst Tomcat is shutdown.

This happens may be because Tomcat didn't shutdown cleanly and so session objects got corrupted during serialization.

MacAnthony
  • 4,471
  • 2
  • 23
  • 26
Raj
  • 600
  • 1
  • 5
  • 18
  • Sure it would make the error go away. But in the sense "If you dont like the noise of your broken exhaust, just don't drive the car" :-) I am looking to actually fix the error. I have a second laptop where I use the same setup (only distro is Fedora) and there it never happens. – yglodt Jan 17 '14 at 09:32
  • 5
    nothing like copying the answer from another thread - Raj - check here http://stackoverflow.com/questions/20622746/exception-loading-sessions-from-persistent-storage If you need session persistence there maybe more advice there...I didn't flag as duplicate as you are looking for debug advice too (not just the workaround) – n34_panda Jan 16 '15 at 16:53
  • This way you are just hiding the error. And maybe postponing a serious problem. – Mehdi Feb 14 '19 at 15:15