本文介绍了无法初始化类org.jfree.chart.JFreeChart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JBoss 7.1运行时服务器,当我构建项目并在localhost上运行它时,我的MAC上出现问题.我总是从无法初始化的JFreeChart库中得到一个错误.我正在使用Maven导入我的所有资料库,而我的资料库是:

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>

以及我用于JFreeChart的依赖项是:

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>

这是错误:

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)

当我在Windows PC本地主机或Linux服务器上运行我的项目时,没有出现此错误.我希望有人能帮助我,并为我的问题提供解决方案.

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.

推荐答案

请确保您的JAR位于WEB-INF/lib文件夹中.如果您使用的是Apache Maven,请在pom.xml

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>

这篇关于无法初始化类org.jfree.chart.JFreeChart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 23:03