java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute -


I have inherited some code and I am getting the error when I try to run it, the error is given below:

  10: 08: 32,093 eRROR [MyServlet]: 260 - servlet.service () java.lang.IllegalArgumentException put MyServlet an exception to the servlet: setAttribute: non-serializable attribute at org.apache on .catalina.session.StandardSession.setAttribute org.apache.catalina.session.StandardSession.setAttribute (StandardSession.java:1248) on org.apache.catalina.session.StandardSessionFacade.setAttribute (StandardSession.java:1270) (on StandardSessionFacade. Java: 130) uk.co.my.servlet.MyServlet.doPost (MyServlet.java:121) javax.servlet.http.HttpServlet.service (HttpSe rvlet.java:647) javax.servlet.http.HttpServlet on .service (HttpServlet.java:729) org.apache.catalina org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:269) on com. On core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:188). My.dd.security.SecurityContextServletFilter.doFilter (SecurityContextServletFilter.java:55) org.apache.catalina.core.ApplicationFilte at rChain.internalDoFilter (ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter at (ApplicationFilterChain .java: 188) org.apache.catalina.authenticator .apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:172) on org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:213) Organization .AuthenticatorBase.invoke (AuthenticatorBase.java:433) on org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve Java: 127) org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117) org. At apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:108) org.apache.catalina at. Org.apache.coyote.http11.Http11AprProtocol $ connector.CoyoteAdapter.service (coyoteadapter.jYR7) org.apache.coyote.http11.Http11AprProcessor.process (Http11AprProcessor.java:835) http 11ConnectionHandler.process (Http11AprProtocol.java: 640) ) at org.apache.tomcat.util.net.AprEndpoint $ Worker.run (AprEndpoint.java: 1286) (unknown source java.lang.Thread.run)  

I think That's the main problem is where it's hitting my code on uk.co.my.servlet at MyServlet.doPost (MyServlet.java:172) . Line of MyServlet 121 session.setAttribute ("LISTENER", myListener);

This myListener object is from the following class:

  public class myListener {static log log = LogFactory.getLog (TerminationListener.class.getName ()); Private boolean should cancel = cancel;  

How do I go about getting rid of this error? Do I Need To Use Transient Keywords?

If you want an example of myListener should be placed in one session , You need to serialize it, it may be may make some fields transient, but those fields will not be saved in the session. You will also need to implement the class to serializable .

I recommend that you see it, which is about a substantial amount of the serialization.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -