我成功设置了BIRT Viewer和PHP / Java Bridge,我可以查看/打开从this sample package通过这两者获得的“testWebReport.rptdesign”报告:
BIRT查看器:
http://192.168.0.90:8080/birt/run?__report=report/testWebReport.rptdesign
PHP / Java Bridge: Source/tutorial
<?php
define ("JAVA_HOSTS", "192.168.0.90:8080");
define ("JAVA_SERVLET", "/JavaBridge/JavaBridge.phpjavabridge");
$pth = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$path_parts = pathinfo($pth);
$imageURLPrefix = $path_parts['dirname'] ."/sessionChartImages/";
require_once("java/Java.inc");
session_start();
$here = getcwd();
$ctx = java_context()->getServletContext();
$birtReportEngine = java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx);
java_context()->onShutdown(java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook());
try{
$report = $birtReportEngine->openReportDesign("${here}/payment.rptdesign");
$task = $birtReportEngine->createRunAndRenderTask($report);
$taskOptions = new java("org.eclipse.birt.report.engine.api.HTMLRenderOption");
$outputStream = new java("java.io.ByteArrayOutputStream");
$taskOptions->setOutputStream($outputStream);
$taskOptions->setOutputFormat("html");
$ih = new java( "org.eclipse.birt.report.engine.api.HTMLServerImageHandler");
$taskOptions->setImageHandler($ih);
$taskOptions->setBaseImageURL($imageURLPrefix . session_id());
$taskOptions->setImageDirectory($here . "/sessionChartImages/" . session_id());
$task->setRenderOption( $taskOptions );
$task->run();
$task->close();
} catch (JavaException $e) {
echo $e; //"Error Calling BIRT";
}
echo $outputStream;
?>
现在我在BIRT for Eclipse中创建一个新报告,然后我尝试通过两种方法运行它,但只有第一个正在运行。对于第二个,我收到了这条消息:
[[o:Exception]:“java.lang.Exception:Invoke failed: [[○:ReportEngine]] - &GT; openReportDesign((○:字符串)[○:字符串])。原因: org.eclipse.birt.report.engine.api.EngineException:设计文件 文件:/ C:/程序%20Files%20(86)/EasyPHP-5.3.9/www/BirtBridgeTest/payment.rptdesign 有错误,无法运行。 VM:1.7.0_04@http://java.oracle.com/“ 在:# - 14 org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.getReportDesignHandle(ReportEngineHelper.java:260) #-13 org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:274) #-12 org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:196) #-11 org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:130) #-10 org.eclipse.birt.report.engine.api.impl.ReportEngine.openReportDesign(ReportEngine.java:304) #-9 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)#-8 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) #-7 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) #-6 java.lang.reflect.Method.invoke(Method.java:601)#-5 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1044)#4 php.java.bridge.Request.handleRequest(Request.java:417)# - 3 php.java.bridge.Request.handleRequests(Request.java:500)# - 2 php.java.bridge.http.ContextRunner.run(ContextRunner.java:145)#-1 php.java.bridge.ThreadPool $ Delegate.run(ThreadPool.java:60)#0 C:\ Program Files (86)\的EasyPHP-5.3.9 \ WWW \ BirtBridgeTest \的java \ Java.inc(232): java_ThrowExceptionProxyFactory-&gt; getProxy(6,'@ V','T',true)#1 C:\ Program Files (86)\的EasyPHP-5.3.9 \ WWW \ BirtBridgeTest \的java \ Java.inc(360): java_Arg-&gt; getResult(true)#2 C:\ Program Files (86)\的EasyPHP-5.3.9 \ WWW \ BirtBridgeTest \的java \ Java.inc(366): java_Client-&gt; getWrappedResult(true)#3 C:\ Program Files (86)\的EasyPHP-5.3.9 \ WWW \ BirtBridgeTest \的java \ Java.inc(560): java_Client-&gt; getResult()#4 C:\ Program Files (86)\的EasyPHP-5.3.9 \ WWW \ BirtBridgeTest \的java \ Java.inc(1752): java_Client-&gt; invokeMethod(4,'openReportDesig ...',Array)#5 C:\ Program Files (86)\的EasyPHP-5.3.9 \ WWW \ BirtBridgeTest \的java \ Java.inc(1851): java_JavaProxy-&gt; __ call('openReportDesig ...',Array)#6 C:\ Program 文件(x86)\ EasyPHP-5.3.9 \ www \ BirtBridgeTest \ java \ Java.inc(1999): java_AbstractJava-&gt; _ call('openReportDesig ...',Array)#7 C:\ Program 文件(x86)\ EasyPHP-5.3.9 \ www \ BirtBridgeTest \ HTMLOutput.php(20): Java-&gt; _call('openReportDesig ...',Array)#8 C:\ Program Files (86)\的EasyPHP-5.3.9 \ WWW \ BirtBridgeTest \ HTMLOutput.php(20): java_InternalJava-&gt; openReportDesign('C:\ Program File ...')#9 {main}]
我已经发现报告的内容不是导致问题的原因,因为如果我创建一个与数据库连接并显示某些图表的报告或者我只是创建一个空白报告并不重要 - 结果是一样的。
有人有解决方案吗?几天来,它确实阻止了我工作中的任何进展。
答案 0 :(得分:3)
我最终通过编辑Eclipse“XML Source”选项卡中的以下行来解决了这个问题:
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
我所要做的就是将版本从3.2.23更改为3.2.2。您可以直接在记事本中编辑.rptdesign文件。