【发布时间】:2014-09-28 10:38:28
【问题描述】:
我是 BIRT 的新手,并设法使用 Eclipse 创建了一些报告。我可以通过 Eclipse 的“BIRT Viewer”查看报告。
但我无法在 Eclipse 之外部署报表。该文档描述了在部署报告之前要部署到应用程序/Web 服务器的“birt.war”。
从哪里可以找到应该具有“BIRT 查看器”的 BIRT 运行时。
提前谢谢,
【问题讨论】:
我是 BIRT 的新手,并设法使用 Eclipse 创建了一些报告。我可以通过 Eclipse 的“BIRT Viewer”查看报告。
但我无法在 Eclipse 之外部署报表。该文档描述了在部署报告之前要部署到应用程序/Web 服务器的“birt.war”。
从哪里可以找到应该具有“BIRT 查看器”的 BIRT 运行时。
提前谢谢,
【问题讨论】:
BIRT运行时必须单独下载,可以在eclipse页面下载:
http://download.eclipse.org/birt/downloads/#runtime
您会在存档中找到 birt.war。
【讨论】:
birt 运行时的最后一个版本在这里http://www.eclipse.org/downloads/download.php?file=/birt/downloads/drops/R-R1-4_4_2-201502171805/birt-runtime-4_4_2-20150217.zip 下载后,您将所有 .rptdesign 文件放入 .war 并部署在您的 java 服务器中。例如:在 tomcat 中是 webapps 文件夹,在 wildfly 中是standalone\deployments。 可以在网址里看到http://localhost:8080/birt/frameset?__report=YOU_REPORT.rptdesign
【讨论】:
您可以使用 BIRT 运行时,或者另一方面,您可以使用从 java 类运行的进程。在这种方法中,您不需要使用 BIRT Runtime,只需将 .jar 文件添加到项目中,您将在文档中看到更多信息。
来自 BIRT 的文档: http://www.eclipse.org/birt/documentation/integrating/reapi.php
刚开始您需要了解 Java 类中的 Runtime 称为 EngineConfig()。
示例:
try{
final EngineConfig config = new EngineConfig( );
//BIRT provides two ways of doing the reports externally
//1.- BIRT Runtime is kind of difficult to configure
//2.- POJO It uses classes into a Java class (You need to import the emitters from the format you'll use and other libraries.
//config.setEngineHome( "C:\\birt-runtime-2_6_2\\birt-runtime-2_6_2\\ReportEngine" );
config.setLogConfig("c:/temp", Level.FINE);
Platform.startup( config );
//If using RE API in Eclipse/RCP application this is not needed.
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
IReportEngine engine = factory.createReportEngine( config );
engine.changeLogLevel( Level.WARNING );
}catch( Exception ex){
ex.printStackTrace();
}
// Run reports, etc.
...
//On the page it's the explanation to create the container and the properties for the report, like the selection of the rptdesign to be used, the parameters, the outputfile path, outputfile format, etc.
//IRunTask and IRunandRenderTask are the method to send the options to the Runtime class that will get the report, output, etc.
//EXACTLY ON THE EMITTERS CONFIGURATION'
// destroy the engine.
try
{
engine.destroy();
Platform.shutdown();
//Bugzilla 351052
RegistryProviderFactory.releaseDefault();
}catch ( EngineException e1 ){
// Ignore
}
【讨论】:
致在生产中使用 BIRT 和/或包含在您的依赖项中的任何人:
对您来说唯一有效的 jar 选项是 4.4.2 版。 4.6.x 和 4.5.x 都包含阻止正确部署和功能的错误。早于 4.4.2 的版本缺少必要的功能。
Click here to check out your build management link on mvnrepository.com.
【讨论】:
我建议将运行时以 maven dependency 的形式包含在您的 Web 项目中。这样您就可以完全控制和无缝集成。
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>4.4.1</version>
</dependency>
【讨论】:
确保更改 genReport.bat -
【讨论】:
请下载 BIRT ENGINE 并将其部署在您的服务器中。 并通过更改 .BAT 文件使其变得灵活。希望对你有帮助
【讨论】: