From: <php...@li...> - 2009-07-31 16:03:57
|
Raja, The way we did it with tomcat is explained here: http://www.theserverside.com/tt/articles/article.tss?l=IntegratingBIRTwithPHP some additional notes are posted here: http://www.birt-exchange.org/devshare/deploying-birt-reports/743-calling-birt-from-php/#description To do it stand alone I just copied the stand alone directory to my php site and created a new directory in it with BIRT libs. Right clicked on the JavaBridge.jar and selected the open with Java. Then wrote php pages to access it. Very simple. Here was one the example pages I used. As you will notice way to many jars. I really did not need them all but wanted to check if this would be an issue. With BIRT you can turn on/off pieces of the engine. I also had some issues with the version of BIRT using static variables so I had to add a work around. This has since been fixed. <?php //define ("JAVA_DEBUG", true); require_once ("java/Java.inc"); $session = java_session(); $here = getcwd(); try { java_require("$here/BIRTReportEngine2.3.1/lib/chartphp.jar;$here/BIRTReportEngine2.3.1/lib/chartengineapi.jar;$here/BIRTReportEngine2.3.1/lib/com.ibm.icu_3.8.1.v20080530.jar;$here/BIRTReportEngine2.3.1/lib/commons-cli-1.0.jar;$here/BIRTReportEngine2.3.1/lib/coreapi.jar;$here/BIRTReportEngine2.3.1/lib/crosstabcoreapi.jar;$here/BIRTReportEngine2.3.1/lib/dataadapterapi.jar;$here/BIRTReportEngine2.3.1/lib/dataaggregationapi.jar;$here/BIRTReportEngine2.3.1/lib/dteapi.jar;$here/BIRTReportEngine2.3.1/lib/engineapi.jar;$here/BIRTReportEngine2.3.1/lib/flute.jar;$here/BIRTReportEngine2.3.1/lib/js.jar;$here/BIRTReportEngine2.3.1/lib/modelapi.jar;$here/BIRTReportEngine2.3.1/lib/modelodaapi.jar;$here/BIRTReportEngine2.3.1/lib/odadesignapi.jar;$here/BIRTReportEngine2.3.1/lib/org.apache.commons.codec_1.3.0.v20080530-1600.jar;$here/BIRTReportEngine2.3.1/lib/dataextraction.jar;$here/BIRTReportEngine2.3.1/lib/org.eclipse.emf.common_2.4.0.v200808251517.jar;$here/BIRTReportEngine2.3.1/lib/org.eclipse.emf.ecore.xmi_2.4.1.v200808251517.jar;$here/BIRTReportEngine2.3.1/lib/org.eclipse.emf.ecore_2.4.1.v200808251517.jar;$here/BIRTReportEngine2.3.1/lib/org.w3c.css.sac_1.3.0.v200805290154.jar;$here/BIRTReportEngine2.3.1/lib/scriptapi.jar;"); if(is_null(java_values($session->get("birtengine")))) { $birtEngineConfig = new java("org.eclipse.birt.report.engine.api.EngineConfig"); $birtEngineConfig->setBIRTHome("C:/xampplite/htdocs/birtphp/BIRTReportEngine2.3.1"); $birtPlatform = new java("org.eclipse.birt.core.framework.Platform"); $birtPlatform->startup($birtEngineConfig); $birtFactory = $birtPlatform->createFactoryObject( "org.eclipse.birt.report.engine.ReportEngineFactory" ); $birtEngine = $birtFactory->createReportEngine( $birtEngineConfig ); $session->put("birtengine", $birtEngine); } $birtEngine = java_values($session->get("birtengine")); $setupChart = new java("chart.work.around.php.ChartMetadataLoader"); $cl = $setupChart->getClass()->getClassLoader(); $setupChart->setupLoader(); $report = $birtEngine->openReportDesign("$here/Reports/TopNpercent.rptdesign"); $task = $birtEngine->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("http://localhost/birtphp"); $taskOptions->setImageDirectory($here); $task->setRenderOption( $taskOptions ); $task->run(); $task->close(); //$birtEngine->destroy(); //$birtPlatform->shutdown(); $file_size = $outputStream->size(); echo $cl->toString(); echo $outputStream; } catch (JavaException $e) { } Jason ________________________________ From: php...@li... [mailto:php...@li...] Sent: Thu 7/30/2009 4:30 PM To: php...@li... Subject: Re: [Php-java-bridge-users] Using PHP/Java Bridge without Tomcat Thanks Jason, > When we worked on the BIRT integration we got it to work without Tomcat, > so I imagine Jasper would work in a similar fashion. The only issue I > worried about is scalability. Maybe this is nothing to worry about but > deserves a little consideration. We just used the STANDALONE method > started the JavaBridge.jar and included all the jars in using the require > method. I also think in same direction, but since we dont have any experience in deploying java application we need exact comands and directory where to place the required jars. can u please give us method for how to start STANDALONE JavaBridge with which user and directory where to place all required jars so that those are available for java_Require method. We need to test difference between Tomcat version and Standalone method. As far as scalability is concerned at later dates is there are complaints about speed or other issues we can very well switch back to tomcat version. If u foresee any issues in this approach let me know. Since already u have got Birt working without tomcat please tell me what u did I work on similar lines. Thanks and best regards Raja ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ php-java-bridge-users mailing list php...@li... https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users |