jazebmazher728 Posted July 25, 2019 Share Posted July 25, 2019 Hi ,I am facing this issue when i am sending custom data through JRBeamDataSource Collection data integrate in php but i am facing this errorWarning: argument 'Collection' is not a Java object,using NULL instead in http://localhost:8080/JavaBridgeTemplate721/java/Java.inc on line 511this is my php code<?phprequire_once("http://localhost:8080/JavaBridgeTemplate721/java/Java.inc");require "collection.php";try { $jasperxml = new java("net.sf.jasperreports.engine.xml.JRXmlLoader"); $jasperDesign = $jasperxml->load(realpath("customer.jrxml")); $compileManager = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager"); $report = $compileManager->compileReport($jasperDesign);} catch (JavaException $ex) { echo $ex;}$fillManager = new JavaClass("net.sf.jasperreports.engine.JasperFillManager");$array1 = [['debit'=> '20.00','credit'=> '50.00'],['debit'=> '10.00','credit'=> '15.00']];$arrayList = new java( 'java.util.ArrayList');foreach($array1 as $key => $a){ $collect1 = new Collection(); $collect1->setDebit($a['debit']); $collect1->setCredit($a['credit']); $arrayList->add($collect1);}//$arrays = ['20.00','30.00','40.00'];$params = new Java("java.util.HashMap");/*$params->put("debit", "30.00");$params->put("credit", "3.00");$params->put("description", "Test123Customer");$params->put("date", "2019-07-22 06:37:09");*/$class = new JavaClass("java.lang.Class");$beanCollection = new Java("net.sf.jasperreports.engine.data.JRBeanCollectionDataSource" , $arrayList);$params->put('DataSource', $beanCollection);$emptyDataSource = new Java("net.sf.jasperreports.engine.JREmptyDataSource");$jasperPrint = $fillManager->fillReport($report, $params, $emptyDataSource);$exporter = new java("net.sf.jasperreports.engine.JRExporter");switch ($_POST['format']) { case 'pdf': $outputPath = realpath(".")."/"."output.pdf"; $exportManager = new JavaClass("net.sf.jasperreports.engine.JasperExportManager"); $exportManager->exportReportToPdfFile($jasperPrint, $outputPath); break;}?> and this is my collection class php<?phpclass Collection { private $debit; private $credit; public function __construct() { $this->debit = ''; $this->credit = ''; } // getter-setter public function getDebit(){ return $this->debit; } public function setDebit($debit){ $this->debit = $debit; } public function getCredit(){ return $this->credit; } public function setCredit($credit){ $this->credit = $credit; }}?>thats why i am seeing reporting value is null plz help me how to resolve this issue in php using php/javabridge not java? Link to comment Share on other sites More sharing options...
swood_1 Posted August 26, 2019 Share Posted August 26, 2019 I don't think there will be many folks in this community that will know the details of the PHP Java bridge enough to answer your question.Maybe this project would be better: https://github.com/cossou/JasperPHP Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now