Jump to content
We've recently updated our Privacy Statement, available here ×

Subreports problem in jasperserver


khammouda

Recommended Posts

 I searched for a couple of days to fix this bug with nothing new.

 

I had a report which include multi-level subreports everything works fine on IReport 3.7.5 I used "subreport.jasper" as subreport expression in the first level & also subreportA.jasper , subreportB.jasper in the second level & place all (the main report & subreports) in the same path.

 

the problem raised when I try to deploy it on my jasperserver

when I try to upload the first main report the IReport wizard offerd me to attach the first subreport.jrxml in resource folder and access it with "repo:subreport.jrxml" or "repo:subreport.jasper".

then I manually upload the second level subreports and do the same thing change the subreport expression to "repo:subreportA.jasper" and "repo:subreportB.jasper"

 

I got Compliation error : Unable to locate the subreport with expression: ""repo:subreport.jasper"". java.lang.Exception: repo:subreport.jrxml not found.

 

I try dozen solution and nothing works. 

using : SUBREPORT_DIR @ the beginning

using full path : repo:/Circuit_Reports/Connectivity/Connectivity_files/

switch between .jasper & .jrxml.

using jasperserver_api_engine_impl_0_fix.jar in lib folder as a fixation to this bug.

I also searched the database record to be sure that they are in the same folder and have the same parent folder.

please advise.

 

Link to comment
Share on other sites

  • Replies 14
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

I had the same problems and here's what I do to get it work:

1. In iReport create main report and subreport - jrxml files are in the file system. Subreport expression is like "$P{SUBREPORT_DIR}" +"subreport.jasper". Everything works in iReport this way.

2. Upload subreport.jrxml to the repository of jasperserver at some location - for example /MyFolder/subreports (of course has to exist). AddResource -> Other -> JRXML file. The name of the resource is without .jrxml at the end  - for example sub1, the file is subreport.jrxml from file system.

3. Change Subreport expression in main report to "repo:/MyFolder/subreports/sub1". Now  it doesn't work in iReport.

4. Add main report as a JasperServer report on the server.

I don't use plugin to upload reports from iReport to jasperserver - just do it manually

 

Good luck

Link to comment
Share on other sites

 Thanks for your help,

I tried this solution and I also got the same error 

Unable to locate the subreport with expression: "$P{SUBREPORT_DIR} + "Connectivity_subreport"". java.lang.Exception: repo:/Circuit_Reports/Connectivity/Subreports/Connectivity_subreport not found.

 

but there is something gained from this, running report don't spit an error but it produce an empty document.

 

keep in your mind that everything is working fine on IReport.

 

thanks.

Link to comment
Share on other sites

Where does  "$P{SUBREPORT_DIR}" in the error message come from? Are you sure that all subreports on all levels are in the jasperserver repository and the subreport expressions in their parents are ok (like "repo:/..." )?  

You can try to upload to jasperserver only main report with middle level subreports, also only middle subreport with inner subreports, so you can see where does this error come from.

About the iReport, I think it doesn't work in my case because I haven't conected it to jasperserver, but if it works for you, then it's even better :)

Link to comment
Share on other sites

It seems like every week someone has a problem with deploying subreports on JasperServer.  A few weeks ago it was my turn, and some really good info got posted at the following location: http://jasperforge.org/plugins/espforum/view.php?group_id=112&forumid=102&topicid=81073#81141

If you get a subreport working in iReport but you get a report not found error once you deploy to JasperServer, the info in this post should help you in the following ways:

1. If you have successfully deployed the subreport on it's own as a useful stand-alone report, it shows how you should make your main report refer to the subreport resource using a full pathname like "repo:/Reports/InterestingReport_files/InterestingReport_jrxml".  Notice the "/" immediately after "repo:".  In the Repository Navigator, my example may look like the pathname is "Organizations | Organization | Reports | InterestingReport | Main jrxml", but it's not really.

2. If the subreport really has no business being run as a stand-alone report, you can instead deploy the subreport as a RESOURCE underneath the main report (after you've deployed the main report, naturally.  In the Repository Navigator, you right click on the Resources folder and Choose "Add").  In that case, you use a relative pathname like "repo:InterestingReport.jrxml".

3. I got some good advice on how I could create a pair of parameters and then change the SubReportExpression property for the report to be based on the value of one of these parameters.  The details are in the posting, but the effect is that when you run the main report in iReport, it prompts you for whether or not you are running locally, and you answer 'true', and it sets the SubReportExpression property to the value you need to run locally on your PC, whereas when you run on JasperServer, it doesn't prompt and the default is set to 'false', so it sets the SubReportExpression property to the value you need when running on the repository version (you should set this value up similar to either the example in #1 or #2 above, depending on how you deploy the subreport).  That way you don't have to keep changing the code of your main report every time you copy from your PC version in iReport to your repository version in JasperServer.  It will run correctly in either environment.

Carl

Link to comment
Share on other sites

 first of all thanks for your help, I tried all of these solutions and more than you can imagine with no help,

it seems that the my jasperserver cannot see the subreports anyway.

I tried all solutions found in this post and it couldn't help , there is something missing I donno what shall it be 

 

may be it is versioning issue or something in the tool itself as I check for every thing is 100% on the right way. 

 

find attached illustrative images for all steps, note that everything is working fine on local IReport.

 

thanks in advance

Link to comment
Share on other sites

In your full pathname, try adding "_files" to the end of the bottom-most folder name:

repo:/Circuit_Reports/Connectivity/Subreports_files/Connectivity_subreport

If that doesn't work, try right clicking on the jrxml file in the Repository Navigator, choose "Properties", and look at the "Parent Folder" on the "General" tab.  Even if it's too long to read the whole thing, you can triple-left-click on it to select the whole thing (even parts you can't see) and then Ctrl-C to copy and then Ctrl-V to paste into Notepad or somewhere so you can read the entire pathname.

Hope that helps.

Carl

Link to comment
Share on other sites

Not sure why my pathnames seem to have some hidden "_files" extension and yours doesn't, but your middle picture certainly seems to indicate to me that you have the full pathname correct (without my "_files" suggestion).  I've had problems distinguishing when I should use a .jrxml (or even _jrxml), .jasper, or no extension on the actual filename part of the resource.  I notice you're not using any extension in the resource name.  Maybe try .jrxml and (if that doesn't work) _jrxml?  I went round and round on this myself, typed up notes of what finally worked for me, and was really hoping my experiences would help you out as well, but if this last suggestion doesn't work, I'm fresh out of ideas.  It's frustrating that the resource names in the repository are so unintuitive.  Good luck.

Carl

Link to comment
Share on other sites

  • 3 weeks later...

 

PROBLEM UPLOADING SUBREPORTS 12/29/2010 11:14

Hi all,

i'm writing because i've a problem with uploading sub-reports into repository.

I've installed jasperserver 3.7.1 (community edition) and Ireport 3.7.1.

Then i've created a main report with a sub-report and when uploaded into repository the automatic procedure has changed SUBREPORT_DIR with repo. So i've not any problem with Ireport 3.7.1.

Later i've tried to install Ireport 3.7.5 and 3.7.6 making the same operations.

When I upload the report it lets the SUBREPORT_DIR without any change and i can't find the sub-report into repository.

This is a great problem because i can't use newest version of Ireport.

Someone of you has the same problem with Ireport versions upper then 3.7.1?

Thank you very much!

Link to comment
Share on other sites

hozawa
Wrote:

http://jasperforge.org/plugins/mwiki/index.php/Jasperserver/Uploading_Report_Units_with_Subreports

Code:
Hello everyodyI've seen the change from SUB_DIRECTORY to REPO is not correct with ireports versions > 3.7.1 and jasperreports CE 3.7.1.It seems subreports are not present in repository.This is a urgent problem to use newest ireports versions.Do you know something?Thanks in advance for your help.
Link to comment
Share on other sites

When I was first having my troubles with deploying subreports to JasperServer repository, I at one point couldn't find my subreports on the repository either, but they were actually there.  The default behavior is that when you deploy your main report and choose to have the plug-in bring over your subreports also, the subreport directory is changed from a local disk drive name to repo: with no /, etc. The relative pathname implies that it expects the subreport to be in the Resources folder under the main report folder.  If you instead think the subreport is useful to run on it's own as a stand-alone report, then I would deploy the subreport separately to the repository and change the pathname that the main report uses to find it.  Check my earlier posts...I've written about this several times in more detail.  Good luck!

Carl

Link to comment
Share on other sites

cbarlow3
Wrote:
 

When I was first having my troubles with deploying subreports to JasperServer repository, I at one point couldn't find my subreports on the repository either, but they were actually there.  The default behavior is that when you deploy your main report and choose to have the plug-in bring over your subreports also, the subreport directory is changed from a local disk drive name to repo: with no /, etc. The relative pathname implies that it expects the subreport to be in the Resources folder under the main report folder.  If you instead think the subreport is useful to run on it's own as a stand-alone report, then I would deploy the subreport separately to the repository and change the pathname that the main report uses to find it.  Check my earlier posts...I've written about this several times in more detail.  Good luck!

Carl

Hi Cbarlow3 and thanks for your answer but this did'nt solve my problem.

The "default behavior" as you say doesn't work in my case (ireport version > 3.7.1) and so after many test i found the right way.
First, I added Main report as "Report Unit" skipping automatic procedure for subreports. Then I added subreport in resources folder as jrxml.

To be sure main report find subreport is important to write the whole path in "subreport expression" just like "repo:/FOLDER_1/FOLDER2/reportname_subreport" without ".jrxml". You can copy the path in the subreport properties field in the reposiitory.

In this way it's all right. Bye!

 

Link to comment
Share on other sites

Well, I'm on Professional Edition 3.7.1.1.  Good to know that now that I finally have it documented how to deploy subreports either as a local resource of the main report or a stand-alone resource, I can look forward to it all behaving differently in a future release.  Sounds like the main difference is that you can't get a relative pathname to work if you deploy the subreports as resources of the main report.

I guess that potentially means that any reports that run correctly today with a relative pathname to subreport resources could break when we upgrade.  It will be one of the first things I test.  Thanks for the heads up.

Carl

Link to comment
Share on other sites

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...