fachhoch Posted July 13, 2009 Share Posted July 13, 2009 We put all our compiled reports inside a package and this package is indside a jar file. here is spring bean configration <bean id="documentFillManagerWrapper" class="gov.fema.JasperFillManagerWrapper"> <property name="sourceFile" value="gov/fema/document//Document1.jasper"/> <property name="dataSource" ref="dataSource"/> </bean> here the sourceFile is the path to my jasper report . Inside this wrapper JasperFillManager.fillReport(getClass().getClassLoader().getResourceAsStream(sourceFile) , parameters, con) I pass the Inputstream of the .jasper file to JasperFillManager , i also pass other parameters , but I have this SUBREPORT_DIR parameter which is the directory path where my sub reports arre located , because all my compiled reports are in a jar file and directory for the contents of the jar file does not make sense , please suggest me how can I pass the value to SUBREPORT_DIR ? Link to comment Share on other sites More sharing options...
teodord Posted July 14, 2009 Share Posted July 14, 2009 Hi, This is an iR issue and you could get better explanations about why it works this way from the iR forums. However, I'll try get a crack at it. I think iR suggest you using a SUBREPORT_DIR parameter, because most of the times people deploy their reports inside Web applications, where the report template files are not part of the classpath and are supposed to be located relative to a base directory, which is probably the root directory of the Web application. In your case, where you package up inside a JAR file (we recommend this approach to JR users), the SUBREPORT_DIR parameter is not very useful for you. You should instead reference subreport templates using their relative location within classpath at runtime. A subreport expression would look like this, in your case: <subreportExpression>"gov/fema/document/Subreport2.jasper"</subreportExpression> If you do this, the report might no longer work in iR, because the subreports might not be found in the classpath that iR uses. But still, this would be the way to do it. I'll work with Giulio to have these things fixed in iR, if they indeed need to be fixed. Also, you could log a bug or a feature request, if you think there is something we should do about iR. Thank you,Teodor 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