|
Re: BIRT + JavaBridge Tutorial [message #647098 is a reply to message #647002] |
Tue, 04 January 2011 10:30   |
Eclipse User |
|
|
|
Osu,
Great tutorial and thanks for putting it together. It would be great if
you could create a link to it in the birt exchange devshare.
Jason
On 1/3/2011 5:38 PM, osuwariboy wrote:
> Hello everyone,
>
> Well, first of all I apologize if I'm not posting this in the right
> place but I really had no idea where else to post it. Anyway, the thing
> is that I had a lot of difficulty setting up BIRT to work correctly with
> JavaBridge.
> Since I could not find any clear tutorial on how to do this, I decided
> to create my own, which I posted on youtube. Here are the links for
> whoever is interested:
>
> http://www.youtube.com/watch?v=79aXbyx52kY
> http://www.youtube.com/watch?v=fb5iSBrw6O4
>
> Also, and this is mainly why I've created this post, in my video, I'm
> giving credit to Jason Weathersby who helped me set things right once
> and for all. Should this pause any sort of problem with you then just
> say the word and I shall remove the videos immediately.
>
> Thanks a lot everyone and have a good viewing ;).
>
> Osu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #707352 is a reply to message #707332] |
Mon, 01 August 2011 10:44   |
Eclipse User |
|
|
|
Dear Jason
Thanks for the reply.
Its ok. Once I got it hosted on my apache web server, it is working all fine.
The BIRT engine has successfully been integrated with my current php application.
It is now possible to view reports within an iframe generated with parameters passed from within the php code itself.
Also i notice it is much faster that using the classic BIRT viewer..
Since there is no frameset similar to the classic BIRT Viewer, i had to write JScript code to handle the export to php, xls, doc and page by page navigation.
I had to create the rptdocument file first and then call the function below to skip to pages
$task->setPageRange("$pageToGo-$pageToGo")
I noticed one thing though: each time i start my Tomcat server and i call a report for the first time, i get a time out.
Also, occassionally, when i run reports after reports intensively for testing, i get a bug report within my iframe:
Fatal error: protocol error: ,Invalid document end at col 94. Check the back end log for OutOfMemoryErrors. in C:\wamp\www\RSSB\BIRT\JavaBridge\java\Java.inc on line 869
I have to restart tomcat and it gets back to normal. Any clue why?
Nevertheless, i am immensely grateful to you and your team. Integrating a powerful reporting engine with php has been a real challenge and its worderful that its now available. Thanks a lot Jason.
I am still testing on Birt 2.6.2. Once i got all the reports done I will switch back to the 3.7 version.
Thanks in advance
Karvesh
|
|
|
Re: BIRT + JavaBridge Tutorial [message #707369 is a reply to message #707352] |
Mon, 01 August 2011 10:55   |
Eclipse User |
|
|
|
On tomcat make sure you have the jvm parameter -XX:MaxPermSize=256M is
set. I set mine in the catalina.bat file. When BIRT first starts up it
takes a some time to startup the platform. This is probably the issue
on the first report. BIRT 3.7 should be much quicker on startup time.
Jason
On 8/1/2011 10:44 AM, karvesh wrote:
> Dear Jason
>
> Thanks for the reply.
> Its ok. Once I got it hosted on my apache web server, it is working all
> fine.
> The BIRT engine has successfully been integrated with my current php
> application.
> It is now possible to view reports within an iframe generated with
> parameters passed from within the php code itself. Also i notice it is
> much faster that using the classic BIRT viewer..
>
> Since there is no frameset similar to the classic BIRT Viewer, i had to
> write JScript code to handle the export to php, xls, doc and page by
> page navigation.
> I had to create the rptdocument file first and then call the function
> below to skip to pages
>
> $task->setPageRange("$pageToGo-$pageToGo")
>
> I noticed one thing though: each time i start my Tomcat server and i
> call a report for the first time, i get a time out. Also, occassionally,
> when i run reports after reports intensively for testing, i get a bug
> report within my iframe:
>
> Fatal error: protocol error: ,Invalid document end at col 94. Check the
> back end log for OutOfMemoryErrors. in
> C:\wamp\www\RSSB\BIRT\JavaBridge\java\Java.inc on line 869
>
> I have to restart tomcat and it gets back to normal. Any clue why?
>
> Nevertheless, i am immensely grateful to you and your team. Integrating
> a powerful reporting engine with php has been a real challenge and its
> worderful that its now available. Thanks a lot Jason.
>
> I am still testing on Birt 2.6.2. Once i got all the reports done I will
> switch back to the 3.7 version.
>
> Thanks in advance
> Karvesh
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #718140 is a reply to message #718012] |
Tue, 23 August 2011 07:39   |
Eclipse User |
|
|
|
Since I had to make BIRT work with PHP recently I share with you all the sequence of actions and installations I've made.
My computer had Windows XP SP3 with XAMPP installed (no Tomcat or java installed on the machine).
So I've made this:
1. Pre-requirements
1.1. Java runtime and SDK
2. Software to Install
2.1. Activate Tomcat on XAMPP. (NOTE: before starting the tomcat, set environment variable - JAVA_HOME to the java SDK directory).
2.2. Download PHP/Java bridge (At: http://php-java-bridge.sourceforge.net/pjb/download.php - version "Documentation". Paste JavaBridge.war file at <Xampp folder>\tomcat\webapps ahd check installation at http://127.0.0.1:8081/JavaBridge/
2.3. Install Commons Logging (Download at: http://commons.apache.org/logging/download_logging.cgi - Binaries, version.zip). Copy .jar files into <Xampp folder>\tomcat\webapps\birt-viewer\WEB-INF\lib\
2.4. Install BIRT Runtime (Download at: http://download.eclipse.org/birt/downloads/ where says "Latest BIRT runtime Release Build") - copy WebViewerExample folder to <Xampp Folder>\tomcat\webapps\ and rename it to Birt-Viewer.
2.5. Start Apache at XAMPP;
2.6. Start Tomcat at<Xampp Folder>, executing catalina_start.bat
2.7. Test tomcat: http://localhost:8080/ (if something saying tomcat shows, it's ok)
2.8. Test JavaBridge: http://localhost:8080/JavaBridge (if something saying javabridge shows, it's ok)
And that's it, you've got it configured and running, just create your PHP web sites and consume the reports using JavaBridge OR BIRT viewer.
If you just want to render the report, use JavaBridge. If you want to render the report and allow printing and exporting out of the box, use Birt viewer (however you must consider security since the access is http and not by file).
Hope this helps!
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #718202 is a reply to message #718140] |
Tue, 23 August 2011 10:53   |
Eclipse User |
|
|
|
Nice writeup. In the beforeOpen script of the data source for a report
that uses connection profiles you can change the jar location or the
profile location.
For example, if you set the resource folder and place your connection
profile in the resource folder you could use a script like:
if(
!reportContext.getHttpServletRequest().getAttribute("attributeBean").isDesigner()
){
myresourcefolder = reportContext.getDesignHandle().getResourceFolder()
this.setExtensionProperty("OdaConnProfileStorePath",
myresourcefolder+"/mysqlclassic.txt");
}
If you want to change the jar location use
this.setExtensionProperty("jarList", "c:/jars/mydbjar.jar");
You could also put the jar in the resource folder and use the script
above to locate it.
In php set the resource folder like:
$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{
//should only be set once will affect all users of the engine
$birtReportEngine->getConfig()->setResourcePath(${here} . "/myresources" );
..
..
..
Jason
On 8/23/2011 7:39 AM, PTPro wrote:
> Since I had to make BIRT work with PHP recently I share with you all the
> sequence of actions and installations I've made.
>
> My computer had Windows XP SP3 with XAMPP installed (no Tomcat or java
> installed on the machine).
>
> So I've made this:
>
>
> 1. Pre-requirements
> 1.1. Java runtime and SDK
>
>
> 2. Software to Install
> 2.1. Activate Tomcat on XAMPP. (NOTE: before starting the tomcat, set
> environment variable - JAVA_HOME to the java SDK directory).
> 2.2. Download PHP/Java bridge (At:
> http://php-java-bridge.sourceforge.net/pjb/download.php - version
> "Documentation". Paste JavaBridge.war file at <Xampp
> folder>\tomcat\webapps ahd check installation at
> http://127.0.0.1:8081/JavaBridge/
> 2.3. Install Commons Logging (Download at:
> http://commons.apache.org/logging/download_logging.cgi - Binaries,
> version.zip). Copy .jar files into <Xampp
> folder>\tomcat\webapps\birt-viewer\WEB-INF\lib\
> 2.4. Install BIRT Runtime (Download at:
> http://download.eclipse.org/birt/downloads/ where says "Latest BIRT
> runtime Release Build") - copy WebViewerExample folder to <Xampp
> Folder>\tomcat\webapps\ and rename it to Birt-Viewer.
> 2.5. Start Apache at XAMPP;
> 2.6. Start Tomcat at<Xampp Folder>, executing catalina_start.bat
> 2.7. Test tomcat: http://localhost:8080/ (if something saying tomcat
> shows, it's ok)
> 2.8. Test JavaBridge: http://localhost:8080/JavaBridge (if something
> saying javabridge shows, it's ok)
>
>
> And that's it, you've got it configured and running, just create your
> PHP web sites and consume the reports using JavaBridge OR BIRT viewer.
>
> If you just want to render the report, use JavaBridge. If you want to
> render the report and allow printing and exporting out of the box, use
> Birt viewer (however you must consider security since the access is http
> and not by file).
>
> Hope this helps!
|
|
|
|
Re: BIRT + JavaBridge Tutorial [message #735286 is a reply to message #718202] |
Tue, 11 October 2011 08:35  |
Eclipse User |
|
|
|
Dear Jason
I am having some problem to pass date parameters from php to birt via the javabridge.
I have declared a parameter in birt of datatype date. Then in my php code i am trying:
$task->setParameterValue("paramDtFrom", new java("java.util.Date", $DTFROM));
However, i am getting an exception error. Then i looked at the Java.inc file in the java bridge where the data types are declared and found the following piece of code:
function __call($method,$args) {
$client=$this->__client;
$sig="@{$this->__signature}@$method";
$len=count($args);
$args2=array($this->__java);
for($i=0; $i<$len; $i++) {
switch(gettype($val=$args[$i])) {
case 'boolean': array_push($args2,$val); $sig.='@b'; break;
case 'integer': array_push($args2,$val); $sig.='@i'; break;
case 'double': array_push($args2,$val); $sig.='@d'; break;
case 'string': array_push($args2,htmlspecialchars($val,ENT_COMPAT)); $sig.='@s'; break;
case 'array':$sig="~INVALID"; break;
case 'object':
if($val instanceof java_JavaType) {
array_push($args2,$val->__java);
$sig.="@o{$val->__signature}";
}
else {
$sig="~INVALID";
}
break;
case 'resource': array_push($args2,$val); $sig.='@r'; break;
case 'NULL': array_push($args2,$val); $sig.='@N'; break;
case 'unknown type': array_push($args2,$val); $sig.='@u'; break;
default: throw new java_IllegalArgumentException($val);
}
Does that mean that date data types cannot be passed via the javabridge?
Should i pass them as string values rather?
Thanks in advance..
Karvesh
|
|
|