I have a following problem and I am wondering where could be the cause. I am trying to load resources form conffolder of the JBoss server.
final String REPORT_DESIGN = "report_name.rptdesign"; //xml file
templateIS = Thread.currentThread().getContextClassLoader().getResourceAsStream(REPORT_DESIGN);
this works fine, I am even able to write the stream into the text file and I get correct result. But problem is when I am trying to pass the input stream to the Birt engine, I always get org.eclipse.birt.report.engine.api.EngineException: The design file <stream> has error and can not be run .
I’ve tried also the version with /beginning of the file.
When I tried to load the same file from resources of my project (so from the jar file with this.getClass().getResourceAsStream), it worked. Also I am reading property file from the same JBoss folder in the same way and it works too. I am really stucked on this one, what could possible cause such strange error?
Add a
nullcheck to make sure you can actually find the resource (ie.Validate.notNull(templateIS, "%s not found in classpath", REPORT_DESIGN)or similar). That will make sure that you can actually find the report.Check whether you have umlauts (characters with code point > 128) in your BIRT report. If you have, then make sure the encoding of the report is correct and that the file is actually in that encoding.