Menu

ClassNotFound error - ChartLineGraphGenerator

Help
2008-06-25
2013-04-25
  • Meghan Pietila

    Meghan Pietila - 2008-06-25

    We've got this set up on 2 Windows Weblogic instances and it's working beautifully, but in our Unix environment we're getting a ClassNotFound on the ChartLineGraphGenerator.  Any ideas?  I'm using the most recent WAR file from SourceForge (with the exception of username changes since we don't have the weblogic user in our environments).

    java.lang.NoClassDefFoundError
        at domainhealth.display.ChartLineGraphGenerator.writeGraphImage(ChartLineGraphGenerator.java:95)
        at domainhealth.display.LineChartServlet.processs(LineChartServlet.java:157)
        at domainhealth.display.LineChartServlet.doGet(LineChartServlet.java:76)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3244)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

    Wonderful tool, by the way, you have my heartfelt thanks for sharing this!!

    Meghan
    Granite Consulting, Inc.

     
    • Paul Done

      Paul Done - 2008-06-26

      Hi Meghan

      I've just checked the source code for method where the NoClassDef occurs and it is:

      public void writeGraphImage(OutputStream out) throws IOException {
          ValueAxis xAxis = new DateAxis(WebLogicMBeanProps.units(WebLogicMBeanProps.DATE_TIME));
          NumberAxis yAxis = new NumberAxis(yAxisUnits);
          yAxis.setAutoRangeIncludesZero(true);       
          XYPlot xyPlotLine = new XYPlot(xySeriesCollection, xAxis, yAxis, new StandardXYItemRenderer(StandardXYItemRenderer.LINES));       
          JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, xyPlotLine, true);
          chart.setBackgroundPaint(java.awt.Color.white);       
          BufferedImage graphImage = chart.createBufferedImage(500, 300, new ChartRenderingInfo(new StandardEntityCollection()));       
          addNoDataLogoIfEmpty(graphImage);
          ChartUtilities.writeBufferedImageAsPNG(out, graphImage); // Could try extra two PNG related params: encodeAlpha and compression
      }

      Line 95 is:

      JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, xyPlotLine, true);

      So it looks like a problem with the class loader locating the class 'JFreeChart'. The import statement for this class is:

      import org.jfree.chart.JFreeChart;

      This class should be contained in the jar 'jfreechart-1.0.9.jar' which in turn should be contained in the path 'WEB-INF/lib' of the domain-health-07.war. Can you check that when you repackaged up war, that the jfreechart jar was included with the correct path and within the jfreechart jar, the JFreeChart class is listed with the relative path of 'org/jfree/chart'.

      What is strange is that the NoClassDef error does not occur earlier in the method for other jfreechart classes like: org.jfree.chart.axis.ValueAxis.

      I have successfully tested in both a Linux and a Solaris environment and I know of at least one client running it in production on Solaris. What exact OS are you running and what version, what JVM and version and what WLS version?

      Also can you tell me the full CLASSPATH that is printed out when you started WLS, in case there is some sort of PRE_CLASSPATH clash.

      Thx

      Paul

       
    • Meghan Pietila

      Meghan Pietila - 2008-07-16

      Thanks for getting back to me, Paul.  The project got busy and I wasn't able to get back the forums until today.

      I did double-check the WAR file that I am deploying on that server, and the jfreechart-1.0.9.jar file looks like it's in the right place and the correct internal setup, as you asked.

      The server is running "SunOS 5.9" (from the WLS console), WLS 9.2.3 with the Sun 1.5.0_11 JVM.

      Part of our problem is that even in QA, I don't have access to the machine so I can't see the startup script or startup classpath.  I'll poke around and see if I can get someone from the ops team who has that information and is willing to share it.  May take a few days.  There are not any modifications made to the out-of-the-box WLS classpath as far as I'm aware (at least, we never requested any and this is a new install).

      Meghan

       

Log in to post a comment.