maartenstachanov.com Posted February 1, 2012 Share Posted February 1, 2012 I create the report, and the subreport correct: if I press preview in the iReport it works correctly.But when I upload it to the server using the server repository it fails: I don't get the dialog "replace this by that " (${dir} +subreport.jasper" with "repo:subreport.jrxml" instead I get an exception displaying: "Message: (Null)"I even tried manually inserting the repo:subreport.jrxml in the main jrxml.I've tried the following: create subreport create main report open repository go to folder "add new JasperReport" select the main report select database source on the repository that works (verified by using a simple report) uploading starts <note: here I would expect the dialog to replace the paths> "Message: (NULL)" refresh repository (Main.jrxml is there, but not the subreport) add the subreport.jrxml in the resources folder download Main.jrxml edit the jrxml variables to refer to: "repo:subreport.jrxml" and upload again run report: exception is displaying that it cannot find the resource "path/to/subreport.jasper".I also tried to edit the mainreport.jrxml to have the right "repo:subreport.jrxml" and upload the subreport manually but that also fails.Greets,Maarten Link to comment Share on other sites More sharing options...
maartenstachanov.com Posted February 2, 2012 Author Share Posted February 2, 2012 I managed to get the subreport working, but it involved manual editing the jrxml.Replace the path to the subreport before you first submit it to the server. edit: the part before you first submit it to the server is because the .jasper file is not regenerated...Post Edited by maartenalbers at 02/03/2012 08:57 Link to comment Share on other sites More sharing options...
cbarlow3 Posted February 2, 2012 Share Posted February 2, 2012 Several months ago I got some great suggestions on how to write the jrxml in such a way that it works in preview mode AND when it's deployed to JasperReports Server so you don't have to keep changing the code each time you change environments. My notes may be out of date (I see that I added further notes to my original notes, etc.), but for what they're worth...Source: djsiders on JasperForge.net 11/23/2010Something I have found useful to have to keep from having to flip back and forth between the repository name and the local file path when working in iReports and the deployed server version of a report.Create a Parameter IS_RUNNING_LOCAL - type Boolean - default value false - use for promptCreate another Parameter SUB_REP_LOCATION - type String - do not use for prompt - set default to code below:$P{IS_RUNNING_LOCAL}.booleanValue() ? "SubReportName.jasper" : "repo:SubRepReposName" Then set your SubReport Expression property to: $P{SUB_REP_LOCATION}Of course change the two report names to match your sub report names. When deploying to the server do not use either of these params as input, just the boolean when running iReports. When you run in iReports, answer true to the IS_RUNNING_LOCAL prompt. This will cause iReports to use the local name/path. When running on the server with no prompt, it will default to false and use the repository name for the subreport.If you are doing a lot of dev work, you can temporarily change the default value to true so you can use the default of the prompt. An added benefit is that iReport will then find and compile the sub-report (at least in later iReport versions) as well.(Carl: I have more luck ending the repo: version of the name with the .jrxml extension. Also, when I run a preview of the main report in iReport, I get warnings during the compilation that the compiler is ‘Unable to locate the subreport with expression: “$P{SUB_REP_LOCATION}”’ Not to worry. That’s just because that parameter is filled in at run-time. As soon as you get the prompt and answer “true”, it should run fine. If you have multiple subreports, just create multiple parameters with different extentions: $P{SUB_REP_LOCATION_ASSETS}, $P{SUB_REP_LOCATION_LIABILITIES}, etc.)(Carl: rumor has it that the default behavior when deploying a main report to JasperServer changed after V3.7.1. One person recommends deploying Main report first, skip automatic procedure for subreports, then deploy subreports in resource folder as separate .jrxml files (or you can deploy them as their own report units for stand-alone capability). Then in the main report, set the subreport expression to the FULL pathname (apparently regardless of whether or not you’ve deployed as a resource), without an extension. It should be something like “repo:/Reports/MainReportName/subreportName”. To find actual full pathname, right click after the subreport in the repository navigator and select “Properties”.)--CarlP.S.: Thanks for posting the solution you found as well...sometimes people who find the answers to their own questions don't post them, and inquiring minds want to know! :)Post Edited by cbarlow3 at 02/02/2012 17:28 Link to comment Share on other sites More sharing options...
maartenstachanov.com Posted February 3, 2012 Author Share Posted February 3, 2012 Thanks for the reply, but I actually need something that doesn't involve people to resolve this problem to XML editing. Link to comment Share on other sites More sharing options...
kcd Posted March 13, 2012 Share Posted March 13, 2012 Agreed. Vote here: jasperforge.org/projects/ireport/tracker/view.php?id=5539 Post Edited by kcd at 03/13/2012 03:36 Link to comment Share on other sites More sharing options...
acarmar Posted May 4, 2012 Share Posted May 4, 2012 Link to comment Share on other sites More sharing options...
acarmar Posted May 4, 2012 Share Posted May 4, 2012 The tool JDeploy! on http://sourceforge.net/projects/jaspertools/?source=directoryallows to deal with reports and subreports deployment on diferents environments (development, pre production, production). It dont touch the datasources when deploying a report, so the systems department can define it. It also defines a estandarized way to package the reports and subreports of a project on a zip file. And includes other utils to list reports, create datasources,... It does not requires editing the jrxml file.I hope to helped you.bye. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now