From: <php...@li...> - 2010-10-27 17:34:24
|
Add this line before calling the method getBirtEngine java("org.eclipse.birt.php.birtengine.BirtEngine")->initBirtConfig(); That should take care of the log file if you added the properties to the BirtConfig.properties file As far as the error goes can you try adding this after you create the task $task = $birtReportEngine->createRunAndRenderTask($report); $mylocale = new java("java.util.Locale","en", "US"); $task->setLocale($mylocale); Jason ________________________________________ From: php...@li... [php...@li...] Sent: Wednesday, October 27, 2010 5:59 AM To: php...@li... Subject: [Php-java-bridge-users] Birt Report HTML rendering exception I get Exception while I try to render Birt report from PHP. 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}] 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); $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()); Report renders to DOC, or PDF without any errors. I couldn't made it to log errors using properties file, so I have no idea how to made it to render it right. Report file enclosed to message, but it works fine in Birt Report Designer. |