Spring Social java.io.NotSerializableException:org.springframework.social.security.SocialAuthenticationServiceRegistry

时间:2015-04-29 04:26:30

标签: spring google-app-engine spring-security spring-social spring-social-twitter

我尝试使用Spring Social通过Twitter在Appengine上使用Spring Security登录并获得以下异常。

使用网址http://localhost:8888/auth/twitter?oauth_token=token_value&oauth_verifier=verified_value

从Twitter重定向后,会出现此错误

任何帮助表示赞赏

错误堆栈跟踪:

java.lang.RuntimeException:java.io.NotSerializableException:org.springframework.social.security.SocialAuthenticationServiceRegistry     在com.google.appengine.tools.development.SerializableObjectsOnlyHashSessionManager $ SerializableObjectsOnlyHttpSession.checkCanSerialize(SerializableObjectsOnlyHashSessionManager.java:66)     在com.google.appengine.tools.development.SerializableObjectsOnlyHashSessionManager $ SerializableObjectsOnlyHttpSession.setAttribute(SerializableObjectsOnlyHashSessionManager.java:43)     在org.springframework.social.security.SocialAuthenticationFilter.addSignInAttempt(SocialAuthenticationFilter.java:336)     在org.springframework.social.security.SocialAuthenticationFilter.doAuthentication(SocialAuthenticationFilter.java:309)     在org.springframework.social.security.SocialAuthenticationFilter.attemptAuthService(SocialAuthenticationFilter.java:246)     在org.springframework.social.security.SocialAuthenticationFilter.attemptAuthentication(SocialAuthenticationFilter.java:157)     在org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:211)     在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)     在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:80)     在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)     在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)     在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)     在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)     在org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)     在org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)     在org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)     在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)     在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)     在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:127)     在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)     在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)     在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)     在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)     在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)     在com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)     在com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)     在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)     在org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)     在org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)     在org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)     在org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)     在com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:98)     在org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)     在com.google.appengine.tools.development.JettyContainerService $ ApiProxyHandler.handle(JettyContainerService.java:503)     在org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)     在org.mortbay.jetty.Server.handle(Server.java:326)     在org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)     at org.mortbay.jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:923)     在org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)     在org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)     在org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)     在org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)     在org.mortbay.thread.QueuedThreadPool $ PoolThread.run(QueuedThreadPool.java:582) 引起:java.io.NotSerializableException:org.springframework.social.security.SocialAuthenticationServiceRegistry     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)     at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)     在com.google.appengine.tools.development.SerializableObjectsOnlyHashSessionManager $ SerializableObjectsOnlyHttpSession.checkCanSerialize(SerializableObjectsOnlyHashSessionManager.java:64)     ......还有61个

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,根本原因是spring-social正在将一个bean(ProviderSignInAttempt具体化)放在会话中,并且在会话中包含非序列化的引用,并且导致NotSerializableException会议持续存在。已经有pull request修复了这个问题,看起来它刚刚与主分支合并,可以在1.1.2.RELEASE中找到。