public static JasperReport getReport(String reportName) {
JasperReport jasperReport = null;
/* ClassLoader previousLoader = null;
Thread t = Thread.currentThread();*/
try {
ReportTemplate template = new ReportDAO().loadByName(reportName);
if (template == null)
throw new Exception("Report template does not exist for name: ".concat(reportName));
ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
ByteArrayInputStream contentInputStream = new ByteArrayInputStream(Base64.decodeBase64(
(new String(template.getContent())).getBytes("UTF-8")));
// previousLoader = t.getContextClassLoader();
// ClassLoader newClassLoader = ctx.getRegistry().getModelAwareClassLoader(
// JasperReportingUtil.class.getClassLoader());
// t.setContextClassLoader(newClassLoader);
jasperReport = JasperCompileManager.compileReport(contentInputStream);