Getting java.io.NotSerializableException with a spring service when stopping tomcat

后端 未结 4 1263
遇见更好的自我
遇见更好的自我 2021-01-13 11:11

i am using spring 3 with JSF 2 and i replaced JSF managed beans with spring beans, by adding on top of bean:

@Component(\"mybean\")
@Scope(\"session\")
         


        
4条回答
  •  抹茶落季
    2021-01-13 11:41

    Looking at the error, It looks like tomcat is trying to serialize the entire spring context, I think it might be due to the fact that your are implementing Serializable on Service. I was thinking may be you need to do this, I don't know JSF that well but my understanding of scoped beans makes me think, You might need some thing like this

        @Component
        @Scope(proxyMode=ScopedProxyMode.TARGET_CLASS, value="session")
        public class MyBean implements Serializable
        {
           //no need to implement serializable on service
           @Autowired(required=true)
           private MyService service;
        }
    

提交回复
热议问题