java.lang.ExceptionInInitializerError JasperReports中的异常

时间:2016-05-14 18:08:08

标签: java jasper-reports securityexception

我已经在NetBeans IDE 8.0.2上安装了iReports插件,我尝试了这段代码:

package Frames;

import java.io.InputStream;
import java.util.*;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.design.*;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.*;
public class reports {

    public reports() {
        try {
            Class.forName("oracle.jdbc.OracleDriver");
            java.sql.Connection con = java.sql.DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ora10g", "employees", "manager");
            InputStream stream = getClass().getClassLoader().getResourceAsStream("/Reports/report1.jrxml");
            JasperDesign jasperDesign = JRXmlLoader.load(stream);
            Map<String, Object> params = new HashMap<String, Object>();
            JasperReport report = JasperCompileManager.compileReport(jasperDesign);
            JasperPrint jasperPrint = JasperFillManager.fillReport(report, params, con);
            JasperViewer.viewReport(jasperPrint, false);
        } catch (Exception x) {
            x.printStackTrace();
        }
    }

    public static void main(String... args) {
        new reports();
    }
}

但我有这样的例外: 运行:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at net.sf.jasperreports.engine.JRPropertiesUtil.loadProperties(JRPropertiesUtil.java:99)    at net.sf.jasperreports.engine.JRPropertiesUtil.loadProperties(JRPropertiesUtil.java:99)
    at net.sf.jasperreports.engine.DefaultJasperReportsContext.initProperties(DefaultJasperReportsContext.java:94)
    at net.sf.jasperreports.engine.DefaultJasperReportsContext.<init>(DefaultJasperReportsContext.java:71)
    at net.sf.jasperreports.engine.DefaultJasperReportsContext.<clinit>(DefaultJasperReportsContext.java:59)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:239)
    at Frames.reports.<init>(reports.java:16)
    at Frames.reports.main(reports.java:27)
Caused by: java.lang.SecurityException: class "org.slf4j.ILoggerFactory"'s signer information does not match signer information of other classes in the same package
    at java.lang.ClassLoader.checkCerts(ClassLoader.java:895)
    at java.lang.ClassLoader.preDefineClass(ClassLoader.java:665)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:758)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
    at net.sf.jasperreports.engine.util.JRLoader.<clinit>(JRLoader.java:68)
    ... 7 more

0 个答案:

没有答案