hyma.m Posted October 10, 2007 Share Posted October 10, 2007 hi all, iam using iReport1.2.5.i have created MasterReport with one subreport.i passed subreport as a parameter in MasterReport. the code as follows..... <subreportParameter name="studentId"><subreportParameterExpression><![CDATA[$F{StudentId}]]></subreportParameterExpression></subreportParameter><connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression><subreportExpression class="java.lang.String"><![CDATA[$P{subReport_path}]]></ subreportExpression></subreport> The parameter contains the complete path of subreport. when iam trying to run the report through java code ,iam getting the following exception... In ReportGenDAO.java Could not load object from location : D:FullMVCMagnusMVCMagnus(Academics)buildwebReportsMarketingStudentDropoutSubReport.jasper Could not load object from location : D:FullMVCMagnusMVCMagnus(Academics)buildwebReportsMarketingStudentDropoutSubReport.jasper wht's problem in that. please help me.thank you. Link to comment Share on other sites More sharing options...
jmurray Posted October 11, 2007 Share Posted October 11, 2007 It doesn't have anything to do with the way you've set up your subreport parameter. The problem is that the report engine can't find the subreport's .jasper file. This will happen for one of two simple reasons: 1) you haven't compiled the subreport so that the .jasper file is available. 2) the path to the subreports .jasper file is not valid in the main report. This can happen if you are building on a PC and publishing to Linux where the relative paths to the same directory are completely different. It can also happen if you have set your default compilation directory (under Options-Settings-Compiler) to anything other than the Reports Directory and you haven't explicitly pointed to the right path in your main report's design. Link to comment Share on other sites More sharing options...
hyma.m Posted October 16, 2007 Author Share Posted October 16, 2007 Thanks for reply. But i couldn't understand that.how to do that,can u please explain that in detail. Thanks in advance. Link to comment Share on other sites More sharing options...
svenn Posted October 16, 2007 Share Posted October 16, 2007 I think the problem is with the path to your subreport. The value that your report is picking up is D:FullMVCMagnusMVCMagnus(Academics)buildwebReportsMarketingStudentDropoutSubReport.jasper Either your missing the / in the path or they are somehow getting removed. Link to comment Share on other sites More sharing options...
vikingh Posted October 17, 2007 Share Posted October 17, 2007 when u are specifying the SUBREPORT_PATH instead of "" use "/" as in java "/" is use for directory or for path. In ur subreport expression write the following: $P{SUBREPORT_DIR} +"/"+ "yourjasperfile.jasper" how to get subreport expresion:right click on subreport, go to properties. Click on subreort(other)tab. Hope this helps u? :) Adios,VikinghPost edited by: vikingh, at: 2007/10/17 03:22 Link to comment Share on other sites More sharing options...
hyma.m Posted October 18, 2007 Author Share Posted October 18, 2007 i followed ur suggestions.But still iam getting the same exception as follows....... In ReportGenDAO.java Could not load object from location : D:FullMVCMagnusMVCMagnus(Academics)buildwebReportsMarketing/StudentDropoutSubReport.jasper the subreport expression i used is <subreportExpression class="java.lang.String"><![CDATA[$P{subReport_path}+"/"+ "StudentDropoutSubReport.jasper"]]</subreportExpression> Link to comment Share on other sites More sharing options...
svenn Posted October 18, 2007 Share Posted October 18, 2007 Probaly because $P{SUBREPORT_DIR} is also not correct I assume the directory that your report is in is called FullMVCMagnusMVCMagnus(Academics)BuildwebReportsMarketing So $P{SUBREPORT_DIR} should be D:/FullMVCMagnusMVCMagnus(Academics)buildwebReportsMarketing Link to comment Share on other sites More sharing options...
pvradhakrishna Posted June 24, 2008 Share Posted June 24, 2008 I solved this by passing a hashmap parameter parameters.put("SUBREPORT_DIR", "actual path to the subreport.jasper file location" );should also end with a backslash , don't forget escape characters '' if you are hard-coding the path rather than use a file.getAbosolutePath() or something.. You have to mention in the subReport.jasper location correctly. First check by opening in i-report the subReport.jrxml report properties to see if the name matches with the correct name, for example, "childReport" given in the parentReport.jrxml's subReport location/expression as $P{SUBREPORT_DIR} + "childReport.jasper" Make sure that the child is compiled to a .jasper before running your parent. If you don't know how to do that let me know!!!Post edited by: pvradhakrishna, at: 2008/06/24 03:52 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