Error occurred:
Jan 4:19:21 PM Org.apache.catalina.core.StandardWrapperValve invoke
SEVERE:Servlet.service () for Servlets [Displaychart] in the context with path [/ALDB] threw exception [Chart image not found] with root cause
Javax.servlet.ServletException:Chart image not found
At Org.jfree.chart.servlet.DisplayChart.service (displaychart.java:149)
At Javax.servlet.http.HttpServlet.service (httpservlet.java:727)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:303)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208)
At Org.apache.tomcat.websocket.server.WsFilter.doFilter (wsfilter.java:52)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208)
At Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:220)
At Org.apache.catalina.core.StandardContextValve.invoke (standardcontextvalve.java:122)
At Org.apache.catalina.authenticator.AuthenticatorBase.invoke (authenticatorbase.java:501)
At Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:170)
At Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:98)
At Org.apache.catalina.valves.AccessLogValve.invoke (accesslogvalve.java:950)
At Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:116)
At Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:408)
At Org.apache.coyote.http11.AbstractHttp11Processor.process (abstracthttp11processor.java:1040)
At Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (abstractprotocol.java:607)
At Org.apache.tomcat.util.net.jioendpoint$socketprocessor.run (jioendpoint.java:313)
At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1110)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:603)
At Java.lang.Thread.run (thread.java:722)
HTML Source code:
/displaychart?filename=jfreechart-5351821214105924657.png
File exists:
Find/-name Jfreechart-5351821214105924657.png-print
/home/soft/tomcat7/temp/jfreechart-5351821214105924657.png
Ll/home/soft/tomcat7/temp/jfreechart-5351821214105924657.png
-rw-r--r--1 root root 21517 Jan 16:19/home/soft/tomcat7/temp/jfreechart-5351821214105924657.png
Related code:
1File File =NewFile (System.getproperty ("Java.io.tmpdir"), filename); 2 if(!(File.exists ())) { 3 Throw NewServletexception ("File" + file.getabsolutepath () + "' does not exist"); 4 } 5 6 BooleanIschartinuserlist =false; 7Chartdeleter Chartdeleter = (chartdeleter) session.getattribute ("Jfreechart_deleter"); 8 9 if(Chartdeleter! =NULL) { TenIschartinuserlist =chartdeleter.ischartavailable (filename); One } A - BooleanIschartpublic =false; - if((Filename.length () >= 6) && the(filename.substring (0, 6). Equals ("public")))) { -Ischartpublic =true; - } - + BooleanIsonetimechart =false; - if(Filename.startswith (Servletutilities.gettemponetimefileprefix ())) { +Isonetimechart =true; A } at - if((ischartinuserlist) | | (ischartpublic) | |(Isonetimechart)) - { - servletutilities.sendtempfile (file, response); - if(Isonetimechart) - File.delete (); in } - Else to { + Throw NewServletexception ("Chart Image not Found"); -}
Workaround:
Servletutilities.settemponetimefileprefix ("Jfreechart"); Add this, so that the 20th line of the above code results in true;
String filename = servletutilities.savechartaspng (chart, 1024x768, n, null, session);
Official explanation:
My Web application runs fine on my Windows development machine, if I deploy it to the Unix/linux production server, It doesn ' t work. What's the problem?
Most likely your server does does have X11 running. This was a Java (awt/java2d) issue, not something, which is specific to Jfreechart. There is some more information at Sun ' s website:
- Http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html
In addition, the following thread in the Jfreechart forum contains some useful information:
- http://www.jfree.org/phpBB2/viewtopic.php?t=1012
REF:
A few points of knowledge about Jfreechart
http://wangrusheng5200.iteye.com/blog/406876
Http://www.jfree.org/jfreechart/faq.html
Http://www.cnblogs.com/dkblog/archive/2007/09/25/1980861.html
Http://www.2cto.com/os/201411/354304.html
Http://www.linuxidc.com/Linux/2011-04/34633.htm
Jfreechart picture files are not displayed on Linux