java.lang.IllegalArgumentException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • When a client obtains an OAuth2AccessToken using Spring Security OAuth2 client filter, this token is encapsulated in a OAuth2ClientContext. This interface is implemented by the DefaultOAuth2ClientContext class. However neither the interface nor the class implements Serializable. After obtaining the access token, the client filter persists the oAuth2ClientContext as a session attribute. Therefore it must be serializable, according to the servlet specification. Thus I obtain this stacktrace in Tomcat 6 when stopping then starting the server : Caused by: java.io.NotSerializableException: org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1585) at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1015) at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:528) at org.apache.catalina.session.StandardManager.unload(StandardManager.java:469) at org.apache.catalina.session.StandardManager.stop(StandardManager.java:678) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4882) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:936) at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1359) at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1330) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:326) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1110) at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:468) at org.apache.catalina.core.StandardService.stop(StandardService.java:604) at org.apache.catalina.core.StandardServer.stop(StandardServer.java:788) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:408) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:338) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416) This is even more blocking in Glassfish, because an error occurs when setting the OAuth2AccessToken in the session : Exception occured in doFilter() method java.lang.IllegalArgumentException: PWC2788: setAttribute: Non-serializable attribute with name scopedTarget.org.springframework.security.oauth2.client.cont ext.DefaultOAuth2ClientContext#0 at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1695) at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:179) at org.springframework.web.context.request.ServletRequestAttributes.setAttribute(ServletRequestAttributes.java:133) at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:44) at org.springframework.web.context.request.SessionScope.get(SessionScope.java:92) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:33) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:182) at $Proxy120.getAccessToken(Unknown Source) at org.springframework.security.oauth2.client.OAuth2RestTemplate.getAccessToken(OAuth2RestTemplate.java:165)
    via by Julien Gerlier,
  • When a client obtains an OAuth2AccessToken using Spring Security OAuth2 client filter, this token is encapsulated in a OAuth2ClientContext. This interface is implemented by the DefaultOAuth2ClientContext class. However neither the interface nor the class implements Serializable. After obtaining the access token, the client filter persists the oAuth2ClientContext as a session attribute. Therefore it must be serializable, according to the servlet specification. Thus I obtain this stacktrace in Tomcat 6 when stopping then starting the server : Caused by: java.io.NotSerializableException: org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1585) at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1015) at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:528) at org.apache.catalina.session.StandardManager.unload(StandardManager.java:469) at org.apache.catalina.session.StandardManager.stop(StandardManager.java:678) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4882) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:936) at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1359) at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1330) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:326) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1110) at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:468) at org.apache.catalina.core.StandardService.stop(StandardService.java:604) at org.apache.catalina.core.StandardServer.stop(StandardServer.java:788) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:408) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:338) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416) This is even more blocking in Glassfish, because an error occurs when setting the OAuth2AccessToken in the session : Exception occured in doFilter() method java.lang.IllegalArgumentException: PWC2788: setAttribute: Non-serializable attribute with name scopedTarget.org.springframework.security.oauth2.client.cont ext.DefaultOAuth2ClientContext#0 at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1695) at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:179) at org.springframework.web.context.request.ServletRequestAttributes.setAttribute(ServletRequestAttributes.java:133) at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:44) at org.springframework.web.context.request.SessionScope.get(SessionScope.java:92) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:33) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:182) at $Proxy120.getAccessToken(Unknown Source) at org.springframework.security.oauth2.client.OAuth2RestTemplate.getAccessToken(OAuth2RestTemplate.java:165)
    via by Julien Gerlier,
  • GitHub comment 688#191954415
    via GitHub by kjjaeger
    ,
    • java.lang.IllegalArgumentException: PWC2788: setAttribute: Non-serializable attribute with name scopedTarget.org.springframework.security.oauth2.client.cont ext.DefaultOAuth2ClientContext#0 at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1695) at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:179) at org.springframework.web.context.request.ServletRequestAttributes.setAttribute(ServletRequestAttributes.java:133) at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:44) at org.springframework.web.context.request.SessionScope.get(SessionScope.java:92) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:33) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:182) at $Proxy120.getAccessToken(Unknown Source) at org.springframework.security.oauth2.client.OAuth2RestTemplate.getAccessToken(OAuth2RestTemplate.java:165)

    Users with the same issue

    Unknown visitor1 times, last one,