I have recently posted a Struts app on a webhost running on a shared JVM environment. The app is running well with the exception of the Jasper reports which are all displaying blank screens. I have used application.getRealPath() and a zillion other methods - I am fairly certain it is a path related problem. My hair is lying in clumps on the floor and my client is out buying a gun. If anyone has any ideas or sample code it would be very much appreciated. The following is the JSP file the sample report is called from (using the absolute path supplied by the webhost):
Connection conn = null;
try{
ManageDatabase mgDB = new ManageDatabase();
try{
conn = mgDB.accessDatabase();
}catch (Exception e){e.printStackTrace();
System.out.print("In getATour Exception");
}
Map parameters = new HashMap();
String tourID = session.getAttribute("theTourID").toString();
parameters.put("TourID", tourID);
JasperDesign jasperDesign = JasperManager.loadXmlDesign("/home/virtual/site127/fst/var/www/html/AdventureTours/reports/TourDetails.xml");
JasperReport aReport = JasperManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperManager.fillReport(aReport, parameters, conn);
byte[] bytes = JasperManager.runReportToPdf(
aReport,
parameters,
conn
);
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(bytes, 0, bytes.length);
ouputStream.flush();
ouputStream.close();
}catch (Exception e){e.printStackTrace();
System.out.print("In getATour Exception");
}