Jump to content
Changes to the Jaspersoft community edition download ×

SOLVED: Subreport is not running on JasperServer


axa2001ro

Recommended Posts

Hello,

 

I have created a report ( which contain a subreport ) with ireport 3.7. I tested on ireport and worked fine. Then I "published" this report on JasperServer ( using "Repository navigator" from Ireport). Now when I run the report the subreport data is not displayed.

This is the first time when it happen this. Until now all published report have run well on server too.

Did you encounter this situation?

 

Thank you for your help!



Post Edited by axa2001ro at 12/07/2010 06:43



Post Edited by axa2001ro at 12/07/2010 06:45
Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

I had similar problems just yesterday.  I recommend reading the forum post at http://jasperforge.org/plugins/espforum/view.php?group_id=112&forumid=102&topicid=81073#81141 (topic is "RESOLVED: Problem with subreport reference after exporting from iReport to JasperServer", which should sound familiar!)

When you deployed the main report to JasperServer, did it also give you the option to deploy the subreport?  If it did, can you see in the Repository Navigator whether it deployed the subreport as a "Resource" of the main report, or did it (or you) deploy it as a separate report that can also be run on its own?

Look at the subReportExpression element in the jrxml of the main report.  If the subreport is deployed as a resource of the main report, this should probably read something like 

<subreportExpression class="java.lang.String"><![CDATA["repo:NameOfSubReport.jrxml"]]></subreportExpression>

On the other hand, if you already have a deployed, working report in the repository that you want to reference as a subreport, it might look more like this full pathname:

<subreportExpression class="java.lang.String"><![CDATA["repo:/Reports/NameOfSubReport_files/NameOfSubReport_jrxml"]]></subreportExpression>

(although your report may not be in a "folder" called "Reports" like mine are...I think I created that folder myself.

If you get that subreport working inside your main report in JasperServer, I then strongly suggest you take the next step, which is to read the suggestion in that forum post from user djsiders.  He recommends NOT hardcoding the <subreportExpression>  to the local or full pathname that makes sense when deployed on the SERVER, because as soon as you do that, it no longer runs in preview mode locally in iReport.  Instead, he suggests setting a VARIABLE pathname based on an input parameter and use that variable pathname (which he recommends keeping in another parameter--one that is NOT prompted for) as the value for the subreportExpression.  The control parameter is a Boolean that identifies whether you are running locally or not.  You set the default to false and set it to prompt, which it will really only do when you are running in iReport.  Details are in that posting.  I took the suggestion yesterday, and it really makes it easier for me to switch back and forth between running a main report in iReport and running that EXACT SAME jrxml once deployed to JasperServer.  But first resolve your problem with running the subreport inside the report...my current assumption is that it's not FINDING the subreport either because you didn't deploy it yet or because you're not pointing to it correctly with the subreportExpression of the main report, but of course, there could be other problems as well.

Good luck!

Carl



Post Edited by cbarlow3 at 11/24/2010 21:55



Post Edited by cbarlow3 at 11/24/2010 22:04
Link to comment
Share on other sites

Thank you for your answer.

My subreport is saved on server in resources. If I delete it the next time when I run the main report I get an error that the subreport is not founded.

I recreated  a simple version of the main report but still the subreport is not printed. :(

I attached the source code of the main report and subreport.


 



Post Edited by axa2001ro at 12/07/2010 06:44
Link to comment
Share on other sites

Well, my advice was mainly about how to solve a subreport not found error.  If your subreport is "not appearing", but it's not getting an error, then it sounds like there's a different problem, like either your subreport NEVER produces output (try running it separately to see), or more likely there is a problem with handing off parameter values that the subreport needs to run correctly.  I found the following web site that has one or two points that could be of help in testing the problem: http://jasperforge.org/uploads/publish/jasperreportswebsite/JR%20Website/faq.html?group_id=252#FAQ16

Link to comment
Share on other sites

I'm stumped.  I figured that a file not found type exception would likely be a problem with the resource name, and a blank report when it normally work correctly would be a parameter hand-off problem, but it sounds like you have some third category of problem.  If you figure it out, please post the solution so I can add it to my notes.

Carl

Link to comment
Share on other sites

  • 2 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...