2011-08-23 40 views
0

我试图从Java中的Pentaho .prpt报告文件生成PDF。经过大量的issues我已经到了这个问题:Java中的Pentaho PDF生成 - 没有注册根处理程序

SEVERE: Failed: 
org.pentaho.reporting.libraries.resourceloader.ResourceCreationException: There are no root-handlers registered for the factory for type class org.pentaho.reporting.engine.classic.core.metadata.parser.ReportPreProcessorMetaDataCollection 
at org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory.create(AbstractXmlResourceFactory.java:176) 
at org.pentaho.reporting.libraries.resourceloader.DefaultResourceManagerBackend.create(DefaultResourceManagerBackend.java:291) 
at org.pentaho.reporting.libraries.resourceloader.ResourceManager.create(ResourceManager.java:389) 
at org.pentaho.reporting.libraries.resourceloader.ResourceManager.create(ResourceManager.java:353) 
at org.pentaho.reporting.libraries.resourceloader.ResourceManager.createDirectly(ResourceManager.java:216) 

这里是我使用的代码:

ClassicEngineBoot.getInstance().start(); 

    final ResourceManager manager = new ResourceManager(); 
    manager.registerDefaults(); 

    final Resource reportResource = manager.createDirectly(getClass().getResource("/reports/test-report.prtp"), MasterReport.class); 

    final MasterReport masterReport = (MasterReport) reportResource.getResource(); 

    PdfReportUtil.createPDF(masterReport, new ByteArrayOutputStream()); 

而这里的POM片段(我使用的库http://repository.pentaho.org/artifactory/pentaho/):

<dependency> 
     <groupId>pentaho-reporting-engine</groupId> 
     <artifactId>pentaho-reporting-engine-classic-core</artifactId> 
     <version>3.8.0-GA</version> 
    </dependency> 

    <dependency> 
     <groupId>pentaho-reporting-engine</groupId> 
     <artifactId>pentaho-reporting-engine-classic-extensions</artifactId> 
     <version>3.8.0-GA</version> 
    </dependency> 

    <dependency> 
     <groupId>pentaho-library</groupId> 
     <artifactId>libloader</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </dependency> 

    <dependency> 
     <groupId>pentaho-library</groupId> 
     <artifactId>libxml</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </dependency> 

    <dependency> 
     <groupId>pentaho-library</groupId> 
     <artifactId>libserializer</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </dependency> 

    <dependency> 
     <groupId>pentaho-library</groupId> 
     <artifactId>libformula</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </dependency> 

    <dependency> 
     <groupId>pentaho-library</groupId> 
     <artifactId>libfonts</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </dependency> 

    <dependency> 
     <groupId>pentaho-library</groupId> 
     <artifactId>libformat</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </dependency> 

    <dependency> 
     <groupId>pentaho-library</groupId> 
     <artifactId>libdocbundle</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </dependency> 

有谁知道如何解决这个问题?

回答

0

1.0快照库已陈旧过时。如果使用3.8,不要使用它们。相信你的maven,并让Maven进入所有图书馆。

你的错误应该尽快停止使用过时的库消失;)

0

您需要波纹管把代码:

ClassicEngineBoot.getInstance().start(); 

内,您的引导。它在Grails中适用于我。

相关问题