Hi, my recent webapp is supposed to generate PDF reports. Because I don't know much about JasperReports, I've outsourced the functionality to a freelancer. He created separate module (jar) that provides desired functionality.
Part of maven structure of my project looks like this: - ngo |---- ngo.pdf |---- src |---- resources |---- DOCOferta.jrxml |---- ngo.webapp where ngo.pdf is this outsourced functionality and ngo.webapp is Wicket webapplication. Now the problem. Freelancer created this piece of code: public InputStream generate() throws GenerationException { Map<String, Object> parameters = new HashMap<String, Object>(); // here parameters JRProperties.setProperty("net.sf.jasperreports.default.pdf.encoding", "UTF8"); try { URL resource = getClass().getClassLoader().getResource("DOCOferta.jrxml"); InputStream inputStream = resource.openStream(); JasperDesign design = JRXmlLoader.load(inputStream); This code works great when run in tests of ngo.pdf but when I try to run generate() method from Wicket (as part of ResourceLink) I get NullPointerException at InputStream inputStream = resource.openStream(); So I get that that the resource "DOCOferta.jrxml" is not found. But the question remains, how to get this work? What should I do to achieve this result: - generate() will not throw NPE, it will generate pdf report [A MUST :)] - all resources needed to create PDF (all the *.jrxml files) stay inside inside ngo.pdf jar (inside the resource folder) [DESIRABLE] I will appreciate any form of help. Best regards, Paul Szulc