2011-08-23 29 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中適用於我。

相關問題