Tomcat警告:无法序列化会话属性ServletRequestAttributes.DESTRUCTION_CALLBACK.SearchService

时间:2016-05-07 05:03:06

标签: java spring session tomcat8 catalina

我应该实施Serializable Interface来解决问题吗?

错误日志:

  

05-May-2016 10:34:16.644警告   [ContainerBackgroundProcessor [StandardEngine [卡塔利娜]]]   org.apache.catalina.session.StandardSession.doWriteObject 不能   序列化会话属性   org.springframework.web.context.request.ServletRequestAttributes.DESTRUCTION_CALLBACK.searchController   对于会话CAA037423C1AEEB003C4B67ED1F34CFF   java.io.NotSerializableException:    com.shoptell.frontoffice.rest.SearchController at   java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)   在   java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)   在   java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)   在   java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)   在   java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)   在   java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)   在   java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)   在   java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)   在   java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)   在   org.apache.catalina.session.StandardSession.doWriteObject(StandardSession.java:1710)   在   org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1109)   在   org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:401)   在   org.apache.catalina.session.StandardManager.unload(StandardManager.java:320)   在   org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:487)   在org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)   在   org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5400)   在org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)   在   org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:827)   在   org.apache.catalina.startup.HostConfig.undeploy(HostConfig.java:1407)   在   org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1333)   在org.apache.catalina.startup.HostConfig.check(HostConfig.java:1555)   在   org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:285)   在   org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)   在   org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)   在   org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1141)   在   org.apache.catalina.core.ContainerBase $ ContainerBackgroundProcessor.processChildren(ContainerBase.java:1377)   在   org.apache.catalina.core.ContainerBase $ ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)   在   org.apache.catalina.core.ContainerBase $ ContainerBackgroundProcessor.run(ContainerBase.java:1349)   在java.lang.Thread.run(Thread.java:745)

代码:

@Scope("session")
@RestController
public class SearchController {
/** methods **/
}

1 个答案:

答案 0 :(得分:0)

尝试使SearchController可序列化:

@Scope("session")
@RestController
public class SearchController implements Serializable {
/** methods **/
}