Hi All,
Currently, I am using jfreechart-1.0.1.jar and tomcat 5.5.9. But when I upgraded to tomcat 5.5.20, tomcat throws the following error:
java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute
at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1255)
at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1233)
at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:129)
at org.jfree.chart.servlet.ServletUtilities.registerChartForDeletion(ServletUtilities.java:313)
at org.jfree.chart.servlet.ServletUtilities.saveChartAsPNG(ServletUtilities.java:192)
In version 1.2 of ChartDeleter.java (which is the released part of the jfreechart.jar - 1.0.3) it doesn't implement java.io.Serializable . However,
in 1.2.2.2 which is the second version on the "STABLE_1-0-0" branch it does implement Serializable.
http://jfreechart.cvs.sourceforge.net/j ... a?view=log
So, I would like to know whether a State version (1.0.4) could be available with ChartDeleter.java implementing the Serializable interface. And if yes, it would be nice to know the estimated date.
The only work around now, is to change the following line FROM:
String filename= ServletUtilities.saveChartAsPNG(chart, imageWidth, imageHeight, info, session);
TO:
String filename= ServletUtilities.saveChartAsPNG(chart, imageWidth, imageHeight, info, null);
I think this will result in the chart not being in session and the chart will be generated from scratch everytime, which will slow the performance.
Any information on this is appreciated.
Thank you,
Suman
ChartDeleter.java doesnt implement Serializable Interface
-
- Posts: 19
- Joined: Mon Mar 27, 2006 5:19 am
Re: ChartDeleter.java doesnt implement Serializable Interfac
I will only slow the performance, when you want reuse the chart. But in most cases the image is intended to be actual, so this behavior is disired anyway.sumanseshadri wrote: I think this will result in the chart not being in session and the chart will be generated from scratch everytime, which will slow the performance.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
ChartDeleter has been made Serializable in CVS, but I'm not sure if that is correct. The purpose of this class is to delete a file (chart image) from the local file system when the user's session expires...it isn't clear to me that this will work in a clustered server environment. In fact, it seems to me that it won't work...but I don't do any server side development work, so perhaps someone else can comment.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Hi,
most application server bind a session in a clustered environment to a specific host. But who ever is using the ChartDeleter (or temporary files) in a clustered environment has no clue about safe and sane programming and deserves all the trouble he gets
The fix itself makes sure that Tomcat and all other servlet container that try to persist sessions to the disk or database can work with that file.
Btw.: The Servlet spec state that each attribute that is added to a SessionContext *has* to be Serializable. If it's not, it's a violation of the standard.
Regards,
Thomas
most application server bind a session in a clustered environment to a specific host. But who ever is using the ChartDeleter (or temporary files) in a clustered environment has no clue about safe and sane programming and deserves all the trouble he gets

The fix itself makes sure that Tomcat and all other servlet container that try to persist sessions to the disk or database can work with that file.
Btw.: The Servlet spec state that each attribute that is added to a SessionContext *has* to be Serializable. If it's not, it's a violation of the standard.
Regards,
Thomas
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Hi Thomas,
Thanks for the follow-up. Given what you've said, I'm happy to leave the Serializable fix in there for the 1.0.4 release (which ought to be out some time this week).
Thanks for the follow-up. Given what you've said, I'm happy to leave the Serializable fix in there for the 1.0.4 release (which ought to be out some time this week).
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 19
- Joined: Mon Mar 27, 2006 5:19 am