由于`ClassNotFoundException:org.springframework.security.web.csrf.DefaultCsrfToken`,Tomcat无法重新加载会话,如何修复?

时间:2017-04-28 07:20:20

标签: java spring tomcat spring-security

当我重新启动tomcat时,它会抛出异常:

Apr 28, 2017 2:33:58 PM org.apache.catalina.session.StandardManager doLoad
SEVERE: ClassNotFoundException while loading persisted sessions: java.lang.ClassNotFoundException: org.springframework.security.web.csrf.DefaultCsrfToken
java.lang.ClassNotFoundException: org.springframework.security.web.csrf.DefaultCsrfToken
    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:5563)
    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:652)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
    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)

在我的项目中,我使用spring security 4.2.2

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-web</artifactId>
    <version>${org.springframework-version}</version>
</dependency>

Tomcat版本:

Server version: Apache Tomcat/7.0.64 (Ubuntu)
Server built:   Jun 29 2016 12:48:32 UTC
Server number:  7.0.64.0
OS Name:        Linux
OS Version:     3.13.0-96-generic
Architecture:   amd64
JVM Version:    1.7.0_111-b01
JVM Vendor:     Oracle Corporation

我的webapp的lib文件夹jar中有一个spring-security-web-4.2.2.RELEASE.jar文件,当tomcat启动时,它运行正常。

如何正确地进行tomcat重装会话,或者如何解决?

谢谢!

0 个答案:

没有答案