Jump to content
Changes to the Jaspersoft community edition download ×

javaw.exe has encountered a problem and needs to c


Recommended Posts

i'm new to jasperreport. Hope someone there can help me.

My problem is when i click jsp to call jasperreport, the report is find but window come out "javaw.exe has encountered a problem and needs to close" and when i click don't send it close my tomcat server also.


help me please!


this is my jsp code!


<%@ page import="net.sf.jasperreports.engine.*" %>

<%@ page import="net.sf.jasperreports.engine.util.*" %>

<%@ page import="net.sf.jasperreports.engine.export.*" %>

<%@ page import="net.sf.jasperreports.j2ee.servlets.*" %>

<%@ page import="java.util.*,java.text.*" %>

<%@ page import="java.io.*" %>

<%@ page import="Commission.*,java.sql.Connection,java.sql.PreparedStatement,java.sql.ResultSet" %>



Date dtTmp1 = new SimpleDateFormat("dd/MM/yy").parse(request.getParameter("txtFromDate"));

String strDate1 = new SimpleDateFormat("yyyy/MM/dd").format(dtTmp1);


Date dtTmp2 = new SimpleDateFormat("dd/MM/yy").parse(request.getParameter("txtToDate"));

String strDate2 = new SimpleDateFormat("yyyy/MM/dd").format(dtTmp2);



File reportFile = new File(application.getRealPath("/reports/commission.jasper"));

if (!reportFile.exists())

throw new JRRuntimeException("File WebappReport.jasper not found. The report design must be compiled first.");


JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());


Map parameters = new HashMap();

parameters.put("ReportTitle", "Address Report");

parameters.put("BaseDir", reportFile.getParentFile());


StringBuffer sb = new StringBuffer();

PreparedStatement pmt = null;

ResultSet rs = null;


Connection con1= DBConnection.getConnection();


sb.append("select distinct d.receipt_no,b.promoter, b.name, a.p_percentage, a.c_percentage, ");

sb.append(" d.promoter, d.unit_pr,e.name as cName, e.suppcomp ");

sb.append(" from suppcomp e, commission a, dept f ");

sb.append("INNER JOIN (stockmst c ");

sb.append("INNER JOIN ( ");

sb.append("promoter b INNER JOIN (salesitem d ");

sb.append("INNER JOIN sales g ");

sb.append("ON d.receipt_no = g.receipt_no) ");

sb.append("ON b.promoter = d.promoter ");

sb.append(") ");

sb.append("ON c.stockmst = d.stockmst ");

sb.append(") ");

sb.append("ON a.commission = b.promoter ");

sb.append("where e.suppcomp = a.comp_code AND f.com = 'Y' AND E.SUPPCOMP = '" + request.getParameter("selName") + "' ");

sb.append("AND g.receipt_d >= '" + strDate1 + "' AND g.receipt_d <= '" + strDate2 + "'");

sb.append("order by b.promoter");


pmt = con1.prepareStatement(sb.toString());

rs = pmt.executeQuery();


JRResultSetDataSource dataObj = new JRResultSetDataSource(rs);


JasperPrint jasperPrint =







JRHtmlExporter exporter = new JRHtmlExporter();


StringBuffer sbuffer = new StringBuffer();


session.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint);


exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "servlets/image?image=");




Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...