JasperReports are not showing up. Please advice
616777Jan 18 2008 — edited Jan 22 2008Hi,
I've a JSP file which is creating the Jasper Reports. My code works fantastic if I run in my local machine (windows xp). The same doesn't work if I create a EAR and deploy in my DEV server (linux).
I've attached the JSP code as well. The line where i have "JasperCompileManager.compileReport()" doesn't run. There is no exception thrown as well. I don't even see the next line log statement printed. It just abruptly stops there and the popup window (which is expected to be a report) closes. I tried giving the context path and the actual path of the server. I tried to store the xml file in the jsp folder itself. Nothing seems to be working my way.
The same code pops up the Jasper Report in PDF form.
Please help me on this.
Thanks
Balaraj
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="java.io.*, java.util.*, com.airliquide.shopping.dataaccess.OracleDAOFactory,java.sql.Connection,javax.sql.DataSource,net.sf.jasperreports.view.JasperViewer,
net.sf.jasperreports.engine.*, net.sf.jasperreports.engine.design.JasperDesign, net.sf.jasperreports.engine.xml.JRXmlLoader,javax.naming.InitialContext,com.airliquide.shopping.business.login.model.SubAccountVO,com.airliquide.shopping.business.login.model.UserDataVO;"
%>
<%
String strFromDate = request.getParameter("strFromDate");
String strToDate =request.getParameter("strToDate");
SubAccountVO subAccountVo = null;
UserDataVO userdataVo = (UserDataVO)session.getAttribute("Userdata");
subAccountVo = userdataVo.getSubAccountVo();
StringBuffer instId = new StringBuffer(""+subAccountVo.getLngInstallationId());
StringBuffer facId= new StringBuffer(""+subAccountVo.getLngFacilityId());
StringBuffer sql = new StringBuffer("select TO_CHAR(h.reading_date,'DD-Mon-YYYY') as ReadingDt, TO_CHAR(h.reading_date,'Mon-YY') as rMnt, floor(h.reading_time / 3600) as hour, (h.reading_time - (floor(h.reading_time / 3600) * 3600)) / 60 as minute, h.reading_time as ReadingTm, to_char(h.installation_capacity,'9,999,999') as InstCapacity, v.std_uom_code as StdUOMCode, h.volume_delivered as VolumeDelivered, to_char(h.volume_delivered,'9,999,999') as strVolDel, h.document_id as DocId, d.manual_document_number as DocNum, l.lot_number as LotNum");
sql.append(" from DI_INSTALLATION_HISTORIES h, cp_installation_equip_v v, Cp_document_headers d, CP_Lot_serial_Numbers l where h.facility_id = '"+facId+"' and h.installation_id= '"+instId+"' and h.document_id = d.document_id(+) and v.installation_id = h.installation_id and v.facility_id = h.facility_id and h.document_id = l.document_id(+) and h.reading_date is not null and h.reading_date >= '"+strFromDate+"' and h.reading_date <= '"+strToDate+"' ");
sql.append(" and h.installation_history_code = 'D' order by h.reading_date");
JasperDesign design = new JasperDesign();
JasperReport report = null;
JasperPrint jasperPrint = null;
Map parameters = new HashMap();
Connection conn = OracleDAOFactory.createConnection();
try{
String sqlQuery = "";
sqlQuery = sql.toString();
com.cgi.utils.LogHelper.info(this.getClass(),"sqlQuery in JSP: "+sqlQuery);
String xmlPath = "";
xmlPath = request.getContextPath() + "/resources/jsp/HistoryReportQuery.jrxml";
//xmlPath = "/d01/oraias/oh_j2ee/j2ee/shopusdevserver/applications/shopusdev/shop/resources/jsp/HistoryReportQuery.jrxml";
com.cgi.utils.LogHelper.info(this.getClass(),"xmlPath: "+xmlPath);
String ALLogo = "/d01/oraias/oh_j2ee/j2ee/shopusdevserver/applications/shopusdev/shop/resources/images/Logobig.gif";
parameters.put("ReportTitle", "Delivery History Report");
parameters.put("sqlQuery",sqlQuery);
parameters.put("strFromDate",strFromDate);
parameters.put("strToDate",strToDate);
parameters.put("ALLogo",ALLogo);
parameters.put("SubAccountVO",subAccountVo);
com.cgi.utils.LogHelper.info(this.getClass(),"before fillReport");
//report = JasperCompileManager.compileReport("c:/Shop@AL/ShoppingWebApp/resources/jsp/JFreeChartReport.jrxml");
report = JasperCompileManager.compileReport(xmlPath);
com.cgi.utils.LogHelper.info(this.getClass(),"report: "+report);
com.cgi.utils.LogHelper.info(this.getClass(),"after compileReport");
jasperPrint = JasperFillManager.fillReport(report, parameters, conn);
com.cgi.utils.LogHelper.info(this.getClass(),"before exportReport");
JasperExportManager.exportReportToPdfFile(jasperPrint, "MyChart.pdf");
com.cgi.utils.LogHelper.info(this.getClass(),"before view report");
JasperViewer.viewReport(jasperPrint,true);
}catch(JRException jrEx){
jrEx.printStackTrace();
}
catch(Exception ex){
ex.printStackTrace();
}
%>
<script language="javascript">
window.close();
</script>
Message was edited by:
balaraj