0

i have one problem since 2 days and I don't understand what happened. I have a page that catching an exception on a new server. In fact, we passed from a jdk 1.6 server to a jdk 1.7 server. On the jdk 1.6 everything was working good, but with the new server the generation of graphs with JFreeChart fail with the following error :

javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.ChartFactory at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:294) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.xxx.LogFilter.doFilter(LogFilter.java:48) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.xxx.filters.EncodingFilter.doFilter(EncodingFilter.java:32) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563) at org.ow2.jonas.web.tomcat6.CheckOpenResourcesValve.invoke(CheckOpenResourcesValve.java:73) at org.ow2.jonas.web.tomcat6.tx.TransactionValve.invoke(TransactionValve.java:90) at org.ow2.jonas.web.tomcat6.ResetAuthenticationValve.invoke(ResetAuthenticationValve.java:88) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.ChartFactory at com.xxx.VisitorHelper.createTotalChart(VisitorHelper.java:147) at

I can't reproduce the bug on my local environment. I saw on other topics that the jvm option"-Djava.awt.headless=true" resolve the problem but it's not my case...

Moreover, I can see the jfreechart-1.0.12.jar file on the WEB-INF repository of my ear which is declare on the pom.xml like this :

<dependency>
        <groupId>jfree</groupId>
        <artifactId>jfreechart</artifactId>
        <version>1.0.12</version>
</dependency>

I can only see a difference between the jdk-s on the two servers.

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
Yacin_A
  • 1
  • 3

3 Answers3

0

Could be a compatibility problem. The groupId of jfree has changed since 2011. Try using the current jfreechart version:

<dependency>
    <groupId>org.jfree</groupId>
    <artifactId>jfreechart</artifactId>
    <version>1.0.19</version>
</dependency>
Lukehey
  • 1,284
  • 1
  • 11
  • 20
  • I tried to update my pom.xml with your suggestion. It works on my local environment, but I still have the same exception on the remote server when I deploy my war. – Yacin_A Feb 05 '16 at 14:13
0

If the jar is really in your classpath, the problem maybe it is caused by a bug in your IDE. Clear the cache would resolve it. The path change according your IDE. This could help How to clear the Cache in NetBeans

Community
  • 1
  • 1
vlopes
  • 1
  • 3
  • As you suggest me, I tried to clear the Netbeans cache but I don't reproduce the exception on my local env it still works. – Yacin_A Feb 05 '16 at 14:33
0

Finally I resolved my problem. It was missing a lib on my server, I added it doing "yum install cups-libs". Now my code is working well :)

Yacin_A
  • 1
  • 3