|
From: <php...@li...> - 2008-04-27 00:09:07
|
Hello, I'm running PHP 5.2.5, php-java-bridge, and Jasperreports 2.0.5,
but with Win32. Your example looks fine, maybe a problem with your JRE.
Benjamin.
php...@li... a écrit :
> Hi everyone. I'm running the following code:
>
> compileReport("/alfweb/demo.jrxml");
> if (is_null (java_values ($jasperReport))) {echo "jasperReport is NULL\n";}
>
> $jasperPrintClass = new JavaClass("net.sf.jasperreports.engine.JasperFillManager");
> if (is_null (java_values ($jasperPrintClass))) {echo "jasperPrintClass is NULL\n";}
>
> $hMap = new Java("java.util.HashMap");
> if (is_null (java_values ($hMap))) {echo "hMap is NULL\n";}
>
> $dataSource = new Java("net.sf.jasperreports.engine.JREmptyDataSource");
> if (is_null (java_values ($dataSource))) {echo "dataSource is NULL\n";}
>
> $jasperPrint = $jasperPrintClass->fillReport($jasperReport, $hMap, $dataSource);
>
> $JasperExportManagerClass = new JavaClass("net.sf.jasperreports.engine.JasperExportManager");
> $JasperExportManagerClass->exportReportToPdfFile($jasperPrint, "/alfweb/simple_report_from_php.pdf");
>
> echo "End of phpjasper.php";
>
> } catch (JavaException $ex) {
> echo "An exception occured: "; echo $ex; echo "\n";
> }
>
> ?>
>
> >From a command prompt I run: php5 phpjasper.php
>
> And I get:
>
> Start of phpjasper.php
> An exception occured: [[o:Exception]:"java.lang.Exception: Invoke failed: [[c:JasperFillManager]]->fillReport((o:JasperReport)[o:JasperReport], (i:Map)[o:HashMap], (i:JRDataSource)[o:JREmptyDataSource]). Cause: java.lang.NullPointerException VM: 1.5.0@http://gcc.gnu.org/java/" at:
> #-26 java.awt.Font.getLineMetrics(Font.java:1024)
> #-25 java.awt.font.TextLayout.(TextLayout.java:195)
> #-24 java.awt.font.TextLayout.(TextLayout.java:257)
> #0 /usr/share/php5/java/Java.inc(265): java_ThrowExceptionProxyFactory->getProxy(6, 'net.sf.jasperre...', true)
> #1 /usr/share/php5/java/Java.inc(417): java_Arg->getResult(true)
> #2 /usr/share/php5/java/Java.inc(423): java_Client->getWrappedResult(true)
> #3 /usr/share/php5/java/Java.inc(627): java_Client->getResult()
> #4 /usr/share/php5/java/Java.inc(1753): java_Client->invokeMethod(3, 'fillReport', Array)
> #5 /usr/share/php5/java/Java.inc(1866): java_JavaProxy->__call('fillReport', Array)
> #6 /usr/share/php5/java/Java.inc(2041): java_AbstractJava->__call('fillReport', Array)
> #7 [internal function]: Java->__call('fillReport', Array)
> #8 /alfweb/phpjasper.php(28): JavaClass->fillReport(Object(java_InternalJava), Object(Java), Object(Java))
> #9 {main}]
>
> I'm running PHP 5.2.5, php-java-bridge 5.2.1, and Jasperreports 2.0.5
>
> I'm new to all of this :( and any help would be much appreciated.
>
> Tony
> _________________________________________________________________
> Find the job of your dreams before someone else does
> http://mycareer.com.au/?s_cid=596064
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
>
|