jolie600 Posted October 16, 2009 Share Posted October 16, 2009 I'm getting an error while trying to use a jrxml file with a subreport in JasperServer. This seems like a pretty basic problem, but I've been searching for a long time and can't find out what I'm doing wrong. I appreciate any help or direction you can offer.I have a main report: "dashboard2.jrxml", that includes a compiled subreport: "yearoveryear_graph_sm.jasper". Both live in my home directory. There's no problem passing parameters and seeing results when I preview dashboard2.jrxml in iReport. However, my new JasperServer report that's based on dashboard2.jrxml has a problem with the subreport.I get this error in the JasperServer report: com.jaspersoft.jasperserver.api.JSExceptionWrapper: Could not load object from location : yearoveryear_graph_sm.jasperWhen the subreportExpression of dashboard2.jrxml is this: <subreportExpression class="java.lang.String"> <![CDATA["yearoveryear_graph_sm.jasper"]]> </subreportExpression>(I've tried variations of including the path and using a string parameter instead of text itself, but came up with the same bad results.)1. Do I just need to find a better place for that subreport .jasper file where JasperServer can find it? Seems likely, as it's currently in my home directory, but I have no idea where to put it.2. Is the subreportExpression class wrong? Should it not be a String? I made a failed blind attempt. When the subreportExpression of dashboard2.jrxml looks like this: <subreportExpression class="net.sf.jasperreports.engine.JasperReport"> <![CDATA[JasperCompileManager.compileReport(net.sf.jasperreports.engine.xml.JRXmlLoader.load(getClass().getResourceAsStream("yearoveryear_graph_sm.jrxml")))]]> </subreportExpression>Again, the report previews fine in iReport, but I get this error when I try to use it in JasperServer: com.jaspersoft.jasperserver.api.JSExceptionWrapper: Error evaluating expression : Source text : JasperCompileManager.compileReport( net.sf.jasperreports.engine.xml.JRXmlLoader.load(getClass().getResourceAsStream( "yearoveryear_graph_sm.jrxml" )))Full jrxml and error text are attached.iReport 3.6.0JasperServer 3.5LinuxApache Tomcat 5.5Thanks in advance!..JoliePost Edited by jolie600 at 10/16/2009 20:11 Link to comment Share on other sites More sharing options...
jolie600 Posted October 16, 2009 Author Share Posted October 16, 2009 Progress....maybe.I added "repo:" to the subreportExpression: <subreportExpression class="java.lang.String"> <![CDATA["repo:yearoveryear_graph_sm.jasper"]]> </subreportExpression>JasperServer then prompted me to add the resource yearoveryear_graph_sm.jasper to the JasperServer report, which I successfully did.And now I'm getting this error: com.jaspersoft.jasperserver.api.JSExceptionWrapper: java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence. ..JoliePost Edited by jolie600 at 10/16/2009 20:10 Link to comment Share on other sites More sharing options...
jolie600 Posted October 16, 2009 Author Share Posted October 16, 2009 Solved. For anyone stumbling across this thread, this is how I solved my own compounded problem(s).I ended up with this in my mainreport.jrxml: <subreportExpression class="java.lang.String"> <![CDATA["repo:subreportname"]]> </subreportExpression>In the Design window, the Subreport Expression property is "repo:subreportname", including double quotes. iReport will not Preview the jrxml like this (it says "Unable to locate the subreport with expression ""subreportname"".").I then based a JasperServer report on the mainreport.jrxml.While editing the JS report, JS prompted me to upload a Resource called subreportname. It wants the subreport jrxml file, NOT the .jasper file. That mistake is what was causing this error: com.jaspersoft.jasperserver.api.JSExceptionWrapper: java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.It took me a ridiculously long time to figure out these issues, so hopefully this explanation helps someone else...JoliePost Edited by jolie600 at 10/16/2009 20:12 Link to comment Share on other sites More sharing options...
dknutson Posted November 4, 2009 Share Posted November 4, 2009 It helped me - Thanks! So it appears that to do this, you first get everything working in iReports, then before sending it up to the JasperServer you need to change the expression by adding "repo". Link to comment Share on other sites More sharing options...
richmaneri Posted November 12, 2009 Share Posted November 12, 2009 This is the point we're at now but there has to be a way to set the value so that it works both locally and on the server Link to comment Share on other sites More sharing options...
manshack_one Posted November 12, 2009 Share Posted November 12, 2009 When I publish a report containing a subreport from iReport using the repository navigator there is a dialog box that displays the modified path for your subreport. It changes your main.jrxml to contain repo: for the subreport element. That works fine until you change something in the main report and just update it. in that case it doesn't change the jrxml to include repo: and now you get the object could not be loaded error. I'm having to drop the report entirely on JS and republish it each time. Only takes a few seconds but that's my work around.Right now my issue is that it's not aware of a nested subreport when it publishes. That means your main.jrxml is changed to include repo: for the subreport it has but the subreport's jrxml is not modified for it's contained subreport. Does that make sense? I added bugtrackers for both issues. Not sure this helps but just know that you're not alone in this regard. Link to comment Share on other sites More sharing options...
shanmei Posted December 15, 2009 Share Posted December 15, 2009 Just to point out that the "repo:" bit of "repo:subreportname" is LITERALLY "repo:", and not your actual repository location. Whereas the "subreportname" bit is of course your subreport name with ".jrxml" extension rather than with the ".jasper" extension that you'd normally use with iReports. For example, your parent report would have a link to the subreport like so: <subreportExpression class="java.lang.String"><![CDATA["repo:my_subreport.jrxml"]]></subreportExpression> That caused me a lot of grief. Link to comment Share on other sites More sharing options...
zhanng Posted April 21, 2011 Share Posted April 21, 2011 Has this changed any in subsequent releases? I seem to have followed the instructions correctly ... I built my report making sure everything lines up right. I viewed the XML file, making the appropriate changes I click the Compile Button (or preview)After that, I get the following exception:java.lang.Exception: repo:subreport1 not found. at com.jaspersoft.ireport.designer.utils.Misc.locateFileFromExpression(Misc.java:1374) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.compileSubreports(IReportCompiler.java:1418) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:509) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) ...Error filling print... Could not load object from location : repo:subreport1 net.sf.jasperreports.engine.JRException: Could not load object from location : repo:subreport1 at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:262) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateReport(JRFillSubreport.java:301) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:327) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:263) ...Any thoughts? Link to comment Share on other sites More sharing options...
andreasX Posted December 5, 2013 Share Posted December 5, 2013 all the solutions above are not working or clearly defining what to do in using designer preview and server functionality: see here for details how to solve it: http://stackoverflow.com/a/20374515/1915920 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