Jasper reports and iReport

Has anyone succeeded in producing Rails reports using jasper reports?
I have prepared reports directly with Jasper’s iReport tool using my
MySQL data. It is a very powerful reporting tool. The reports look
greate.

But I have not been able to produce the reports from my Rails
application. I have followed the instructions provided at:

http://wiki.rubyonrails.org/rails/pages/HowtoIntegrateJasperReports

but am unable to make it work. I am probably not doing something
really basic, relatively new at Rails. When I enter the URL for the
controller “http://localhost:3000/reports/report” as described in the
tutorial (above) I get the following error:

“Expected ./app/helpers/send_doc_helper.rb to define SendDocHelper”

Should I do something else first?

I have the same problem, but I’m kind of solving it to get my test
going by simply copying the code from send_doc_helper.rb into the
helper of the controller where I’m calling Jasperreports.
It is running now, but I don’t get any output yet. There are however
quite some deprecation warnings in the log.
Let me know how you are getting on.

VSIntl schreef:

I was just doing some investigating on JasperReports yesterday and read
through that wiki page thoroughly. Seems like a prime candidate for
someone who knows what they’re doing to make into a plugin or gem. I’m
thoroughly lost trying to figure out what I need to do to get this to
work.

FlexRails wrote:

I have prepared reports directly with Jasper’s iReport tool using my
controller “http://localhost:3000/reports/report” as described in the
tutorial (above) I get the following error:

“Expected ./app/helpers/send_doc_helper.rb to define SendDocHelper”

Should I do something else first?


http://www.5valleys.com/
http://www.workingwithrails.com/person/8078

I still have to try the suggestion from Fred but I got it to work on
my development machine. I had to jump through some loops, but it does
work.
I can now develop and test a report with iReport and call it from Ruby
on Rails.
If anyone is interested let me know and I will post some additional
information on how I got it to work.

On 18 Jan 2008, at 21:26, VSIntl wrote:

but am unable to make it work. I am probably not doing something
really basic, relatively new at Rails. When I enter the URL for the
controller “http://localhost:3000/reports/report” as described in the
tutorial (above) I get the following error:

“Expected ./app/helpers/send_doc_helper.rb to define SendDocHelper”

What if you do what the error message is suggesting? Change the name
of the module in send_doc_helper.rb to be SendDocHelper instead of
SendDoc, and change
helper :send_doc
include SendDoc
to
helper :send_doc
include SendDocHelper
Fred

On 06 Feb 2008, at 11:51, FlexRails wrote:

I still have to try the suggestion from Fred but I got it to work on
my development machine. I had to jump through some loops, but it does
work.
I can now develop and test a report with iReport and call it from Ruby
on Rails.
If anyone is interested let me know and I will post some additional
information on how I got it to work.

A blog or wiki post with the whole procedure and all pitfalls would
be nice. Do you run Jasper Reports as a Webservice or through a
commandline call?

Best regards

Peter De Berdt

@Fred
Thanks Fred. It works the way you suggested.

@Peter
It’s based on
http://wiki.rubyonrails.org/rails/pages/HowtoIntegrateJasperReports
, so it’s command line and it’s fast enough for me.
Where do you think I should put the Wiki description ?

On 06 Feb 2008, at 15:07, FlexRails wrote:

@Peter
It’s based on http://wiki.rubyonrails.org/rails/pages/
HowtoIntegrateJasperReports
, so it’s command line and it’s fast enough for me.
Where do you think I should put the Wiki description ?

The page you mentioned above might be a good place :slight_smile:

Best regards

Peter De Berdt

I hope I’m not stepping upon this thread but continue to ask if anyone
is integrating barcodes into .pdf outputs in Rails?
I thought perhaps you good people might be somehow involved in
inventory applications.
Thank you,
Kathleen

On Feb 6, 3:51 am, FlexRails [email protected] wrote:
If anyone is interested let me know and I will post some additional
information on how I got it to work.

Yes, Please!

ok, I will update the wiki, but I need a little bit of time. I’ll try
to this this tonight.

On 07 Feb 2008, at 16:10, jef wrote:

does jasper reports work on a shared hosting plan?

Does an ultra cheap car come with advanced options like voice
commands, keyless entry, active safety systems, wifi hookups, …?

Simple answer: no.

JasperReports is not so easy to deploy an a hosted site, because it
requires a Java server (Tomcat, Weblogic, Resin or something else),
which isn’t supported by most providers.

Best regards

Peter De Berdt

does jasper reports work on a shared hosting plan?

Jef

I have updated the
http://wiki.rubyonrails.org/rails/pages/HowtoIntegrateJasperReports
wiki page with a complete description on how I got JasperReports to
work from rails. I hope it will be usefull for some of you.
Success.

If you want to use JasperReports as a webservice, yes indeed it will
take some effort to get it all set up correctly, although these days,
you will find hosting plans including Tomcat servers (or other Servlet/
JSP engines).

If you want to use JapserReports as a command line service, deployment
is actually quite simple as long as you are allowed to run Java
processes on your hosting server, but a lot of plans allow (short
running) Java processes.

On Feb 7, 3:26 pm, FlexRails [email protected] wrote:

I have updated thehttp://wiki.rubyonrails.org/rails/pages/HowtoIntegrateJasperReports
wiki page with a complete description on how I got JasperReports to
work from rails. I hope it will be usefull for some of you.
Success.

Thanks for the info Flex. I’ve set things up like you described, but
am still having a couple small issues.

  1. With a very simple “Hello World” report with just a static text
    element, I’m able to compile the report and all but when I render it
    through rails, I get a completely blank PDF. Anybody had a similar
    problem? thoughts?

  2. iReport on Ubuntu7.10 seems to have stability issues. I’ve
    installed 2.04, 2.00 and 1.1.0 and all will freeze up when I try to
    compile or execute a report with any kind of dynamic data, and
    sometimes even when I’m just trying to work with a “hello world”
    report with a single static text element. anybody have any thoughts
    on that?

Flex, thanks a ton for your assistance.

My report preview in iReport is now working great even with dyanmic
data (on our token windows xp box). I’ve got the “hello world” text
in the “page header” “banner” and a couple dynamic fields in the
“detail” banner. the “build/execute with active connection” gives me
exactly what I would expect for the page heard and the dynamic data.
However, when I put the compiled .jasper file in app/reports I still
get a blank pdf.

There are some differences in what I put in the app/jasper/lib
directory compared to your instructions.
a) you mention a jdt-compiler.jar, but my download of iReport 2.0.4
contained a jdt-compiler-3.1.1.jar. At first, I figured that was just
a typo on your part. Later I also found a plain jdt-compiler.jar in
the jasperreports_on_rails archive and tried that, too. Neither
helped.
b) you mention a log4j-1.2.13.jar. However, my 2.0.4 iReport only
contains a log4j-1.2.8 and 1.2.9 jars. I put both of those in the lib
directory but that didn’t work.then I found the log4j-1.2.13.jar in
the jasperreports_on_rails archive and replaced the other two with
it. Still blank.

So, right now my lib dir has all the same 11 .jar files you mention in
your instructions (and no others), the only exceptions being that jdt-
compiler.jar and log4j-1.2.13.jar came from the jasperreports_on_rails
download instead of the latest version of iReport.

Still getting a blank pdf file though. any more ideas?

  1. In which banner have you put your static ‘Hello world’ text,
    because when I put it in the title banner, or in detail, and I try to
    run it from within iReport I get a message ‘The document has no
    pages.’ The compilation however succeeds. In that case of course there
    will be no output when you call the report from rails.
    If you really got a report preview in iReport but no output in rails
    you might look for a file called XmlJasperInterface.log somewhere in
    your rails application and see if you find some more information
    there. I had the same problem untill I copied the iReport lib files to
    my rails/app/jasper/lib directory. So you might double check if you
    have missed any of the lib files.

  2. I’m running on a Mac and there it works fine. I suppose you could
    develop your reports on a platform where iReport runs stable, and then
    still deploy to Ubuntu.

Is there anyone who was successfull using my description, otherwise I
will have to check my description for possible errors ?

Also, if I completely remove the .jasper file, I get the expected java
errors, and when I put it back I’m back to the blank pdf’s, so I am
sure that it’s finding and using the correct .jasper file. (just to
rule out one possible problem)

WhooHoo! Got it working. I had a typo in the xml_start_path I was
passing to send_doc. With the two special files copied from
jasperreports_on_rails instead of from iReport, and my typo fixed,
it’s working great.

I’m going to work on simplyfing this code and either posting some
alternate/simplified instructions to my blog or possibly even creating
a Rails plugin that makes all this a lot easier to do. I’ll post an
update to this thread if/when that happens. Flex, if you want to
collaborate on the plugin, holler!