質問

I successfully set up BIRT Viewer and PHP/Java Bridge and I can view/open "testWebReport.rptdesign" report got from this sample package through both of them like this:

BIRT Viewer:

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;

?>

Now I create a new report in BIRT for Eclipse and then I try to run it through both methods but only the first one is working. For the second one I got this message:

[[o:Exception]:"java.lang.Exception: Invoke failed: [[o:ReportEngine]]->openReportDesign((o:String)[o:String]). Cause: org.eclipse.birt.report.engine.api.EngineException: The design file file:/C:/Program%20Files%20(x86)/EasyPHP-5.3.9/www/BirtBridgeTest/payment.rptdesign has error and can not be run. VM: 1.7.0_04@http://java.oracle.com/" at: #-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 (x86)\EasyPHP-5.3.9\www\BirtBridgeTest\java\Java.inc(232): java_ThrowExceptionProxyFactory->getProxy(6, '@V', 'T', true) #1 C:\Program Files (x86)\EasyPHP-5.3.9\www\BirtBridgeTest\java\Java.inc(360): java_Arg->getResult(true) #2 C:\Program Files (x86)\EasyPHP-5.3.9\www\BirtBridgeTest\java\Java.inc(366): java_Client->getWrappedResult(true) #3 C:\Program Files (x86)\EasyPHP-5.3.9\www\BirtBridgeTest\java\Java.inc(560): java_Client->getResult() #4 C:\Program Files (x86)\EasyPHP-5.3.9\www\BirtBridgeTest\java\Java.inc(1752): java_Client->invokeMethod(4, 'openReportDesig...', Array) #5 C:\Program Files (x86)\EasyPHP-5.3.9\www\BirtBridgeTest\java\Java.inc(1851): java_JavaProxy->__call('openReportDesig...', Array) #6 C:\Program Files (x86)\EasyPHP-5.3.9\www\BirtBridgeTest\java\Java.inc(1999): java_AbstractJava->_call('openReportDesig...', Array) #7 C:\Program Files (x86)\EasyPHP-5.3.9\www\BirtBridgeTest\HTMLOutput.php(20): Java->_call('openReportDesig...', Array) #8 C:\Program Files (x86)\EasyPHP-5.3.9\www\BirtBridgeTest\HTMLOutput.php(20): java_InternalJava->openReportDesign('C:\Program File...') #9 {main}]

I already found out that it's not the content of the report what is causing the problem because it doesn't matter if I create a report which has a connection to the database and displays some charts or I just create a blank one - the result is the same.

Does anybody have a solution for this? It's really preventing any kind of progress in my work for a few days now.

役に立ちましたか?

解決

I finally solved this problem by editing the following line in Eclipse "XML Source" tab:

<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">

All I had to do was to change version from 3.2.23 to 3.2.2. You can do that by editing the .rptdesign file directly in notepad.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top