3 Replies Latest reply on Mar 10, 2006 12:29 AM by glen woods

    using JFreeChart from an EJB

    cwelsh Newbie

      Hi, I am trying to use JFreeChart from an EJB under JBoss. I am using JBoss version 3.2.2 and JFreeChart version 0.9.15. I have deployed the JFreeChart jar under $JBOSS_HOME//lib and restarted the server. I am using a stateless session bean to try to instantiate some JFreeChart objects. Certain JFreeChart classes can be instantiated just fine. For example, the following line (apparently) works fine -

      DefaultCategoryDataset set = new DefaultCategoryDataset();

      However, I get a NoClassDefFoundError when I try to instantiate other
      classes, like so: PiePlot plot = new PiePlot();

      So, certain classes in the same package are found and instantiated ok,
      but others are not.

      I _think_ the problem is trying to render a graphical component in a "headless" environment. I have tried setting my DISPLAY variable when restarting JBoss, and I have also tried using the
      -Djava.awt.Headless=true when starting JBoss. I still get the same

      Can anyone offer some advice or a brief tutorial on using JFreeChart or something similar under JBoss?


      Catie Welsh

        • 1. Re: using JFreeChart from an EJB
          sam ramirez Newbie

          I know it's been a while since this post went out, I'm doing this for those that are having this specific problem and don't know what to do.

          First, and this may not be related, but I'm running jboss 3.2.3 and jfreechart 0.9.16 and thought there was a bug. I found out that that the JBoss default config, consolemgr.sar has jfreechart archived within it, which Jboss uses. It uses that same version for other contexts and ears. I finally figured it out and had to replace that version with the latest, probably not the best idea, but the version that comes with jboss doesn't have all the features I was looking for. It worked.

          I also ran the thing without the console manager/web console deployed (removed the management subdirectory in deploy directory) and everything worked fine that way as well, you just don't get the management console anymore.

          Also, you need to include jfreechart in the ejb.jar file to make your ejb's work with anything. The war and ejb.jar are separate worlds.

          The headless switch is only necessary if the server is truly headless like a unix server with no x terminal. Windoze doesn't need it, usually.

          As far as tutorials on jfreechart you'll either have to buy their docs or here's what I did, I looked through all of the demo source files that are buried deep in the source code. They are in a subdirectory called 'demo'. Search and find.


          • 3. Re: using JFreeChart from an EJB
            glen woods Newbie

            To how to use jfreechart
            I don^t think there has any different between jsp and ejb

            You can find how to use it in jfreechart tutorial at below site