1

EDIT:

Hi there i am using JBoss 7.1 Runtime Server and i have an Problem on my MAC when i build my Project and run it on localhost i get always an ERROR from the JFreeChart Library that it could not initialize. I'm using Maven to import all my Library's my repository's was:

<repositories>
        <repository>
            <id>java.net2</id>
            <name>Repository hosting the jee6 artifacts</name>
            <url>http://download.java.net/maven/2</url>
        </repository>
        <repository>
            <id>JBoss repository</id>
            <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
        </repository>

        <repository>
            <id>org.openfaces</id>
            <url>http://repository.openfaces.org/repository</url>
        </repository>
        <repository>
            <id>jfree</id>
            <url>http://www.ibiblio.org/maven/jfree/</url>
        </repository>
    </repositories>

and the dependency what i use for JFreeChart was:

        <dependency>
            <groupId>jfree</groupId>
            <artifactId>jcommon</artifactId>
            <version>1.0.16</version>
        </dependency>

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

Here is the ERROR:

exception

javax.servlet.ServletException: Could not initialize class org.jfree.chart.JFreeChart
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
root cause

java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Class.java:171)
    org.openfaces.taglib.internal.chart.AbstractStyledComponentTag.checkJFreeChart(AbstractStyledComponentTag.java:33)
    org.openfaces.taglib.internal.chart.AbstractStyledComponentTag.setComponentProperties(AbstractStyledComponentTag.java:27)
    org.openfaces.taglib.internal.chart.ChartTag.setComponentProperties(ChartTag.java:39)
    org.openfaces.taglib.facelets.AbstractFaceletsComponentHandler.setAttributes(AbstractFaceletsComponentHandler.java:54)

When i Run my Project on a Windows PC localhost or on a Linux Server i didn't get this ERROR. I hope someone can help me and give me a solution for my Problem.

Zeropointer
  • 510
  • 2
  • 7
  • 24
  • Well it looks like you've probably not included the `JFreeChart` jar file in the right place - please edit your question to give details of how you're deploying your app. – Jon Skeet Aug 19 '13 at 05:51

2 Answers2

1

Please ensure you have your JAR in WEB-INF/lib folder. If your are using Apache Maven kindly include the following dependency in pom.xml

<dependency>
    <groupId>jfree</groupId>
    <artifactId>jfreechart</artifactId>
    <version>1.0.13</version>
</dependency>
user2339071
  • 4,254
  • 1
  • 27
  • 46
  • yes i'm yousing Apache Maven and i have include the following dependency in the pom.xml My Problem is it works all on a Linux or Windows PC but i'm working on a MAC – Zeropointer Aug 19 '13 at 06:02
  • Try the following steps : 1.) Maven Clean --> Maven Build --> Refresh Project --> Run As. – user2339071 Aug 19 '13 at 06:03
  • I have check the steps Maven Clean --> Maven Build --> Refresh Project --> Run As but it would not work i have always the same ERROR – Zeropointer Aug 19 '13 at 06:35
  • Try adding the JAR directly to the `lib` folder and remove dependency of `JFreeChart` from `pom.xml`. Try to rebuild using above steps. Can you see the `JfreeChart` jar in your `target` folder once you build the application.. ? – user2339071 Aug 19 '13 at 07:00
  • I have add the JAR directly and remove the dependency but it would not work. – Zeropointer Aug 19 '13 at 08:36
  • Is it showing the same error.. ? Or has the error message changed.. ? – user2339071 Aug 19 '13 at 09:30
  • Try this website. Tinker around with `` until you find the one that suits you. http://wiki.openfaces.org/display/OF/Installation+and+Configuration+3.x – user2339071 Aug 19 '13 at 15:01
  • My main problem is that i get this ERROR on MY MAC OSX when i run my Application on a Windows PC of an workmate it works without the Problem. After long Search i found http://hi.baidu.com/xuliangjunsilu/item/b3b9a324c0b2cc869c63d18c but i can't find any definitions of DISPLAY environment variable. can someone help me? – Zeropointer Aug 20 '13 at 07:17
  • Check this link: http://stackoverflow.com/questions/5115339/tomcat-opts-environment-variable-and-system-getenv – user2339071 Aug 20 '13 at 07:49
1

I guess you're running on a headless environment so UI (awt) doesn't work, so pass -Djava.awt.headless=true to make it work

Anton
  • 1,432
  • 13
  • 17