Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » JavaBridge HTML render exception
JavaBridge HTML render exception [message #630015] Thu, 30 September 2010 11:50 Go to next message
Janusz Paszynski is currently offline Janusz PaszynskiFriend
Messages: 8
Registered: August 2010
Location: Warsaw, Poland
Junior Member

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.
Re: JavaBridge HTML render exception [message #630114 is a reply to message #630015] Thu, 30 September 2010 16:40 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Janusz

Can you post the report? One way to get the engine logging is to create
a BirtConfig.properties file with the following contents:

logDirectory=c:/test/mylogs
logLevel=FINE

jar the properties file and put it in the bridge web-inf/lib directory.


Jason

On 9/30/2010 7:50 AM, Janusz Paszynski wrote:
> 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.doR un(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:14 5)
> #-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.
Re: JavaBridge HTML render exception [message #635539 is a reply to message #630114] Wed, 27 October 2010 09:47 Go to previous messageGo to next message
Janusz Paszynski is currently offline Janusz PaszynskiFriend
Messages: 8
Registered: August 2010
Location: Warsaw, Poland
Junior Member

So I added this properties file (packed into BirtConfig.jar) and It actually have changed nothing.

Properties file:
logDirectory=c:/tmp/
logLevel=FINE

Log directory exists, but is empty after try of generation HTML page from report.

I'm using webinterface and have no idea how to enclose my rptdesign file. Actually I don't think there is any problem in it, because it works in BirtDesigner preview.
Re: JavaBridge HTML render exception [message #635678 is a reply to message #635539] Wed, 27 October 2010 17:19 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Add this line before calling the method getBirtEngine
java("org.eclipse.birt.php.birtengine.BirtEngine")->initBirtConfig();

That should take care of the log 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


On 10/27/2010 5:47 AM, Janusz Paszynski wrote:
> So I added this properties file (packed into BirtConfig.jar) and It
> actually have changed nothing.
>
> Properties file:
> logDirectory=c:/tmp/
> logLevel=FINE
>
> Log directory exists, but is empty after try of generation HTML page
> from report.
>
> I'm using webinterface and have no idea how to enclose my rptdesign
> file. Actually I don't think there is any problem in it, because it
> works in BirtDesigner preview.
>
Previous Topic:some page blank
Next Topic:Java Script auto-complete
Goto Forum:
  


Current Time: Tue May 14 10:36:11 GMT 2024

Powered by FUDForum. Page generated in 0.04181 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top