I try to render report to HTML using JavaBridge via PHP. I get exception:
[[o:Exception]:"java.lang.Exception: Invoke failed: [[o:RunAndRenderTask]]->run. Cause: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report VM: 1.6.0_20@http://java.sun.com/" at:
#-11 org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:188)
#-10 org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75)
#-9 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
#-8 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
#-7 sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
#-6 java.lang.reflect.Method.invoke(Unknown Source)
#-5 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1028)
#-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 http://127.0.0.1:8080/JavaBridge/java/Java.inc(232): java_ThrowExceptionProxyFactory->getProxy(12, '@V', 'T', true)
#1 http://127.0.0.1:8080/JavaBridge/java/Java.inc(360): java_Arg->getResult(true)
#2 http://127.0.0.1:8080/JavaBridge/java/Java.inc(366): java_Client->getWrappedResult(true)
#3 http://127.0.0.1:8080/JavaBridge/java/Java.inc(560): java_Client->getResult()
#4 http://127.0.0.1:8080/JavaBridge/java/Java.inc(1752): java_Client->invokeMethod(7, 'run', Array)
#5 http://127.0.0.1:8080/JavaBridge/java/Java.inc(1851): java_JavaProxy->__call('run', Array)
#6 http://127.0.0.1:8080/JavaBridge/java/Java.inc(1999): java_AbstractJava->__call('run', Array)
#7 [internal function]: Java->__call('run', Array)
#8 C:\wamp\www\test\tst_birt.php(31): java_InternalJava->run()
#9 {main}]
from PHP code:
<?php
require_once("http://127.0.0.1:8080/JavaBridge/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}/ankieta.rptdesign");
$task = $birtReportEngine->createRunAndRenderTask($report);
$task->setParameterValue("Top Count", new java("java.lang.Integer", 6));
$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->setParameterValue("id_pracownik","85");
$task->run();
$task->close();
} catch (JavaException $e) {
echo $e; //"Error Calling BIRT";
}
echo java_values($outputStream->toByteArray());
The problem is I don't get any exceptions from Birt Viewer 2.5.2. I tried with JavaBridge 6.1.2 and newer 6.2.1rc4 (Birt 2.6.0). I have no idea how to interprate this exception. What is more mysterious export to DOC/XLS/PDF via PHP code works fine and same code for HTML for other reports (created using same Birt Designer (2.5.2)) works fine.