Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.io.NotSerializableException: org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl for session-scoped bean when stopping Tomcat [SPR-9847] #14480

Closed
spring-issuemaster opened this issue Oct 2, 2012 · 3 comments
Assignees
Labels

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Oct 2, 2012

Boris Romashov opened SPR-9847 and commented

Here is my controller (it is Serializable).

@Scope (WebApplicationContext.SCOPE_SESSION)
@Controller
public class Some implements Serializable
{

	@RequestMapping ("/go")
	@ResponseBody
	public String go()
	{
		return "!!!";
	}


	@PostConstruct
	public void init()
	{
		System.out.println("Some.init");
	}

	@PreDestroy
	public void beforeDestroy()
	{
		System.out.println("Some.beforeDestroy");
	}

}

When I stop a server I see the following stacktrace.

02.10.2012 19:32:02 org.apache.catalina.session.StandardSession writeObject
WARNING: Cannot serialize session attribute some for session 0DBD895D2086D2E121AD199A63D33DF2
java.io.NotSerializableException: org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
	at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
	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.stop(Catalina.java:662)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Affects: 3.1.1

5 votes, 5 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 24, 2012

Chris Beams commented

Boris Romashov, could you put together a reproduction issue per the instructions at https://github.com/SpringSource/spring-framework-issues? Thanks.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 9, 2014

Szilard Szabo commented

Same at 4.1.0.RELEASE

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Dec 25, 2018

Sébastien Deleuze commented

Cannot reproduce this (very old) issue with Spring Boot 2.1.1 / Spring Framework 5.1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.