I'm running a test using Apache+PHP, Tomcat and JavaBridge to try to load BIRT and render a document. This is the PHP file:
<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
require_once('http://127.0.0.1:8081/Bridge/java/Java.inc');
$here = getcwd();
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}/TopNPercent.rptdesign");
$task = $birtReportEngine->createRunAndRenderTask($report);
$taskOptions = new java("org.eclipse.birt.report.engine.api.PDFRenderOption");
$outputStream = new java("java.io.ByteArrayOutputStream");
$taskOptions->setOutputStream($outputStream);
$taskOptions->setOutputFormat("pdf");
$task->setRenderOption( $taskOptions );
$task->run();
$task->close();
} catch (JavaException $e) {
echo $e; //"Error Calling BIRT";
}
//echo $outputStream;
echo java_values($outputStream->toByteArray());
?>
Once I access it through Apache+PHP i receive the following error:
<br />
<b>Fatal error</b>: Uncaught [[o:Exception]:"java.lang.Exception:
ReferenceClass failed: new org.eclipse.birt.php.birtengine.BirtEngine. Cause:
java.lang.ClassNotFoundException: org.eclipse.birt.php.birtengine.BirtEngine VM:
1.7.0_04@http://java.oracle.com/" at:
#-10 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438)
#-9 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284)
#-8 java.lang.Class.forName0(Native Method)
#-7 java.lang.Class.forName(Unknown Source)
#-6 php.java.bridge.Util.classForName(Util.java:1518)
#-5 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:445)
#-4 php.java.bridge.Request.handleRequest(Request.java:444)
#-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:8081/Bridge/java/Java.inc(232): java_ThrowExceptionProxyFactory->getProxy(3, 'org.apache.cata...', 'T', false)
#1 http://127. in <b>http://127.0.0.1:8081/Bridge/java/Java.inc</b> on line <b>195</b><br />
127.0.0.1:8081 is Tomcat server. It seems it isn't able to find "org.eclipse.birt.php.birtengine.BirtEngine" class. I copied birt-runtime-3_7_2/lib folder's contents to JavaBridge's WEB-INF/lib but it doesn't help. I've tried searching for the answer on various sites, but the only one, I think actualy the same problem with no answer is here: LINK. Does anyone know a solution to this problem or how to make that JavaBridge would see that class?