*
The moose likes Other Open Source Projects and the fly likes jasper in a WebApp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "jasper in a WebApp" Watch "jasper in a WebApp" New topic
Author

jasper in a WebApp

Michael Houlo
Ranch Hand

Joined: Jun 07, 2010
Posts: 58
Hello,

I generated a jrxml file and a jasper file with iReport.
I made a simple swing application to generate a pdf file from those files. It worked perfectly.

Now, i tryed to integrate it into my web application.
I use the same way to generate it :


This is the content of my Servlet page. It imports the jasper classes and there isn't any compilation error.

Now, when i run it, i have some runtimes errors..



I know there is already a thread about it in this forum but it looks like he simply forgots to add jars into the classpath..
Since my servlet doesn't have any compilation errors, i guess my classpath is correct.
Here is a part of it :


I hope you can tell me what's wrong with that
Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

For whatever reason, you're missing a/some required library in the deployment. Showing Ant (I assume?) stuff doesn't really tell us what's being deployed. I would have said that JR had several more dependencies than you show here, too, like iText, at the very least.
Michael Houlo
Ranch Hand

Joined: Jun 07, 2010
Posts: 58
I'm using WSAD.
Well, it looks like the missing classes are the ones include in jaspere2.0.2.jar .
That's why i'm so confused :s
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Are they being deployed? Have you added the rest of its dependencies? I don't recall having to do anything other than deploy everything, and that was also using WSAD.
Michael Houlo
Ranch Hand

Joined: Jun 07, 2010
Posts: 58
I've got a good question for you >_<

How do i check it ?
Michael Houlo
Ranch Hand

Joined: Jun 07, 2010
Posts: 58
Ok, you were right.
It's a missing jar ! ( jdt-compiler.jar .. maybe it'll help someone else in the future ).

Still, i can't understand why i had no compilation error and why this errors happen only at runtime .. (with no details.. )
Can you explain me how to make sure we added all dependencies, how do i check what's exactly being deployed ?

Thanks a lot.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Because reports in XML form are compiled at runtime if you don't pre-compile them.

Transitive dependency management is why things like Maven and Ivy were invented. You can always check the JR dependency list on their site.
Michael Houlo
Ranch Hand

Joined: Jun 07, 2010
Posts: 58
Yes but the import clause from the XML file was exactly the same as the Servlet ones.

Interesting, i think i'll give it a try and use Maven or Ivy then

Thanks a lot for your help and your time.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You asked why it happened at runtime--because jrxml files are compiled at runtime.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jasper in a WebApp