Генерация PDF в Пентахо в java - нет зарегистрированных обработчиков root - PullRequest
0 голосов
/ 23 августа 2011

Я пытаюсь сгенерировать PDF из файла отчета Pentaho .prpt на Java. После ряда проблем я достиг этой проблемы:

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>

Кто-нибудь знает, как это исправить?

Ответы [ 2 ]

0 голосов
/ 03 сентября 2013

Вы должны поместить код ниже:

    ClassicEngineBoot.getInstance().start();

Внутри вашей начальной загрузки.Это сработало для меня, в Grails.

0 голосов
/ 25 августа 2011

Библиотеки снимков 1.0 устарели и устарели.Не используйте их, если вы используете 3.8.Доверяй своему мавену и позволь Мейвену вытащить все библиотеки.

Ваша ошибка должна исчезнуть, как только вы перестанете использовать устаревшие библиотеки;)

...