Java:Tomcat 7从持久存储加载会话的异常:ClassNotFoundException

时间:2017-01-21 18:07:26

标签: java session tomcat

重新启动Tomcat 7后,我将丢失所有活动会话。

在catalina.out文件中,我可以看到以下内容:

Jan 21, 2017 6:38:02 PM org.apache.coyote.AbstractProtocol stop
INFORMATION: Stopping ProtocolHandler ["ajp-bio-8009"]
Jan 21, 2017 6:38:02 PM org.apache.coyote.AbstractProtocol destroy
INFORMATION: Destroying ProtocolHandler ["ajp-bio-8009"]
Jan 21, 2017 6:38:10 PM org.apache.coyote.AbstractProtocol init
INFORMATION: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 21, 2017 6:38:10 PM org.apache.catalina.startup.Catalina load
INFORMATION: Initialization processed in 595 ms
Jan 21, 2017 6:38:10 PM org.apache.catalina.core.StandardService startInternal
INFORMATION: Starting service Catalina
Jan 21, 2017 6:38:10 PM org.apache.catalina.core.StandardEngine startInternal
INFORMATION: Starting Servlet Engine: Apache Tomcat/7.0.56 (Debian)
Jan 21, 2017 6:38:10 PM org.apache.catalina.startup.HostConfig deployWAR
INFORMATION: Deploying web application archive /var/lib/tomcat7/webapps/ROOT.war
Jan 21, 2017 6:38:11 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFORMATION: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [179] milliseconds.
Jan 21, 2017 6:38:11 PM org.apache.catalina.session.StandardManager doLoad
SCHWERWIEGEND: ClassNotFoundException while loading persisted sessions: java.lang.ClassNotFoundException: de.mumscasino.core.User
java.lang.ClassNotFoundException: de.mumscasino.core.User
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:278)
    at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:628)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1779)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
    at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1619)
    at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1084)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:285)
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:202)
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:492)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5534)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1879)
    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)

Jan 21, 2017 6:38:11 PM org.apache.catalina.session.StandardManager startInternal
SCHWERWIEGEND: Exception loading sessions from persistent storage
java.lang.ClassNotFoundException: de.mumscasino.core.User
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:278)
    at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:628)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1779)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
    at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1619)
    at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1084)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:285)
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:202)
    at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:492)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5534)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1879)
    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)

de.mumscasino.core.User是我的ROOT.war类,用于控制应用程序中的所有用户值。启动后我的应用程序运行没有任何问题。 JSP和Servlet能够找到这个类并使用它。可以创建和关闭会话。关闭Tomcat后,我可以看到创建的SESSION.ser文件。

我检查了我的代码。用户实现了java.io.Serializable,这个类的所有字段都是boolean,String,int或者也是java.io.Serializable。

在我的带有本地Tomcat7的eclipse IDE中,我可以重新启动它而不会丢失我的会话。我不知道我现在可以尝试解决的问题。

0 个答案:

没有答案