Home
Analytics
using my report files with tomcat and birt viewer
sunadmn
Ok so I have built my reports I have installed Tomcat and the BIRT viewer, tested it and all works fine. My question is how the heck do I get my report up on my server so I can have it on the web now?
I have searched and searched with no luck can anyone help point me to a doc that actually shows one how to deploy myt report now that I have all the key parts in place?
Thanks all,
-Stephen
Find more posts tagged with
Comments
JasonW
If you have deployed the viewer you will see a directory WebViewerExample in the tomcat webapps directory. Just export your report from the designer to this directory and then specify the report name in the url like __report=myreport.rptdesign.
Jason
sunadmn
<blockquote class='ipsBlockquote' data-author="JasonW"><p>If you have deployed the viewer you will see a directory WebViewerExample in the tomcat webapps directory. Just export your report from the designer to this directory and then specify the report name in the url like __report=myreport.rptdesign.<br />
<br />
Jason</p></blockquote>
<br />
Thanks for the reply Jason quick question now when you say export do you mean export from the SDK itself?<br />
<br />
-Stephen
JasonW
No I mean export the report from the designer. Just right click on it in the navigator view and export it.
Jason
sunadmn
<blockquote class='ipsBlockquote' data-author="JasonW"><p>No I mean export the report from the designer. Just right click on it in the navigator view and export it.<br />
<br />
Jason</p></blockquote>
<br />
Ok I see what you mean now, I was playing around with this earlier and wasn't sure what export format I should use here (my best guess was a .war file since I am using an application server but that doesn't seem to work). What format do you do the export in?<br />
<br />
Thanks,<br />
-Stephen
JasonW
You can put the reports in the war, but you can also put them anywhere that your app server will let users have access to. Just use a full path in the __report parameter.
Jason
sunadmn
<blockquote class='ipsBlockquote' data-author="JasonW"><p>You can put the reports in the war, but you can also put them anywhere that your app server will let users have access to. Just use a full path in the __report parameter.<br />
<br />
Jason</p></blockquote>
<br />
See this is the issue I have Jason. I want to be able to have Windows users building these reports (they have embedded images i.e. background and flat file Data Sources) and since we have absolute paths this seems to break things. So like with any web based tool, say dreamweaver it allows one to design local with all the absolute pathing done at upload time. Will doing the export to the war file accomplish this also?<br />
<br />
Also like I said I can't export to the war file as I get empty drop down menu for "Web Project" so not sure which option is the best to choose here and how to overcome the path issues to make this a more viable solution.<br />
<br />
Any ideas here?<br />
<br />
Thanks again,<br />
-Stephen
JasonW
Once the war is deployed, the rpt design can be just copied to the exploded war directory and use nothing but relative paths. Put libraries, images, etc in the resource folder that you configure in the web.xml.
Jason
sunadmn
<blockquote class='ipsBlockquote' data-author="JasonW"><p>Once the war is deployed, the rpt design can be just copied to the exploded war directory and use nothing but relative paths. Put libraries, images, etc in the resource folder that you configure in the web.xml.<br />
<br />
Jason</p></blockquote>
<br />
Ok Jason maybe we are on different pages here as I have never touched any web.xml file(s).<br />
<br />
Let's explain how I am actually getting to where I am currently and hope things helps explain this better:<br />
<br />
I build my report from a .csv flat file on my windows box that has local images in it (local to my desktop). I save this report to it's chosen location on my box. Once it's saved I copy ,via scp, the report file to my UNIX host (Solaris box) running Tomcat. Once I have the report on the UNIX box I have to then open up a vi session to edit the report file to have the correct absolute paths since UNIX and windows pathing are not the same. What I want to NOT have to do is that edit step. I would like to be able to export directly from the reporting engine in some format that I can just push the report out and all would be good. Now the .war file seems like the best bet since I could then just use the Tomcat manager to deploy/undeploy the reports with ease. The problem here is when I am in the navigator pane of the report designer perspective in the SDK I right click on the project folder and choose "export" this in turn brings me to a window that says "Select and export destination" with a window filled with expandable folders. One of the folders says "Web", which seems to be a no brainer here as that's where I want this to end up and the option there is WAR file. I choose this and then I get another selection window asking for "Web project" that is a drop down menu with nothing in it and then below that another drop down menu for "Destination". Since I have no Web project I can't export from here to WAR files.<br />
<br />
Does this help explain things a bit better?<br />
<br />
Thanks,<br />
-Stephen
JasonW
Stephen,
Understood. Libraries an images are relative if you are using the images from a resource folder ( you do not have to change the web.xml but you can). If you download the wtp integration package you can use it to deploy the viewer, but this is also optional. It sounds like the file location of the csv is your major pain point. And that is where you want to use property binding or scripting. You can add the following script to the before open of the report datasource to address the pathing issue:
if( reportContext.getHttpServletRequest().getAttribute("attributeBean").isDesigner() ){
//we are in the designer do not change anything
}else{
var rp = reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath("/csvfiledirectory");
// assume you have added a csvfiledirectory to your webapp
if( rp == null ){
//cant find csv directory
}else{
this.setExtensionProperty("HOME", rp);
//or set the path to any location you want
}
}
Does this make sense?
Jason
JasonW
BTW Actuate does provide a comercial solution that allows 1 push to server report publishing.
Jason
sunadmn
Jason thanks for the reply there and yes that does make a lot more sense. I have toyed with the idea of actually just taking my .csv files and just building a simple MySQL DB to house the data as I could then just write a short Perl script to populate the DB with the data and add another layer of automation.
Now the scripting you used in the header of the xml could that also be ported to change the location of the images also? I would imagine yes since it looks to just be acting on the properties in the xml for "home".
The last question I have is where you are talking about resource folders, now does that mean if I add the image as a resource it will stay actually embedded into the report file?
Thanks again for all your time Jason.
-Stephen
JasonW
That script was in the beforeOpen of the dataset. Images have similar capabilities.
Images in the resource folder are not embedded, BIRT can use embedded images but resource images are relatively linked.
Jason
sunadmn
So it really sounds to me that to get all that I want out of BIRT I really should get a supported version and not use the Eclipse version.
Thanks again for all your help.
On a side note is there a good article that explains the deploy process a bit further than the notes on the BIRT page off the Eclipse site? It just really seems to fall short of good knowledge past the point of getting Tomcat up and running and I have seem to be able to find a good place that explains this well or at all. It's been a kinda guess up to this point.
JasonW
I think the comerical stuff has a lot to offer, like interative viewer which allows users of your report to customize it in the browser. Deployment is easier etc. <br />
<br />
On the Open Source side, I wrote an article a couple of years ago that is still pretty accurate.<br />
<a class='bbc_url' href='
http://onjava.com/pub/a/onjava/2006/07/26/deploying-birt.html'>Deploying
BIRT - O'Reilly Media</a><br />
<br />
There is also several webinars here on BEX that show how to deploy, integrate etc.<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/be/news-events/webinars/archived-webinars/'>Archived
Webinars</a> <br />
<br />
<br />
There is also a great article on TSS that shows libraries:<br />
<a class='bbc_url' href='
http://www.theserverside.com/tt/articles/article.tss?l=EclipseBRT'>Enterprise
Java Community: Using Eclipse BIRT Report Libraries and Templates</a><br />
A few things have changed but it will give you the idea.<br />
<br />
Jason
sunadmn
<blockquote class='ipsBlockquote' data-author="JasonW"><p>I think the comerical stuff has a lot to offer, like interative viewer which allows users of your report to customize it in the browser. Deployment is easier etc. <br />
<br />
On the Open Source side, I wrote an article a couple of years ago that is still pretty accurate.<br />
<a class='bbc_url' href='
http://onjava.com/pub/a/onjava/2006/07/26/deploying-birt.html'>Deploying
BIRT - O'Reilly Media</a><br />
<br />
There is also several webinars here on BEX that show how to deploy, integrate etc.<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/be/news-events/webinars/archived-webinars/'>Archived
Webinars</a> <br />
<br />
<br />
There is also a great article on TSS that shows libraries:<br />
<a class='bbc_url' href='
http://www.theserverside.com/tt/articles/article.tss?l=EclipseBRT'>Enterprise
Java Community: Using Eclipse BIRT Report Libraries and Templates</a><br />
A few things have changed but it will give you the idea.<br />
<br />
Jason</p></blockquote>
<br />
Jason once again let me thank thank thank you for being such a great help here. I will take a look at these links for sure.