Problem with JasperReports

asked 2010-11-16 08:55:26 +0800

giordan gravatar image giordan
48 2

updated 2010-11-16 08:57:05 +0800

Hi to all!

I'm using ZK 5.0.5 and I'm new in the use of JasperReports.
With iReport 3.7.4 I have build my report2.jasper which show data from a table of my Oracle DB retrieved via JDBC connection.
I'have placed this report in my web application under WebContent/report/, and I've copied jasperreports-3.7.6.jar under the lib folder.
And this is the portion of code that recall the report:

			<jasperreport id="report" src="/report/report2.jasper" type="pdf"/>

But I've this bad result:
HTTP Status 410 - /view/z_0wu/zG8Pnp1/0/report/report2.pdf - <Jasperreport report> non trovata.


type Status report

message /view/z_0wu/zG8Pnp1/0/report/report2.pdf - <Jasperreport report> non trovata.

description The requested resource (/view/z_0wu/zG8Pnp1/0/report/report2.pdf - <Jasperreport report> non trovata.) is no longer available, and no forwarding address is known.


Apache Tomcat/6.0.26

Can anyone help me to get my report?
Thanks in advance, best regards


delete flag offensive retag edit

8 Replies

Sort by » oldest newest

answered 2010-11-16 10:13:59 +0800

twiegand gravatar image twiegand
1807 3


Based on the HTTP 410 and message, it sure seems that it can't find your .jasper file. Are you sure your src path is resolving correctly?


link publish delete flag offensive edit

answered 2010-11-16 15:10:15 +0800

FujitsuConsulting gravatar image FujitsuConsulting
165 1

A few things I found with JasperReport and ZK:

1. The version of JR in ZK is not up to date, I had to use iReport 3.7.0 to generate a working .jasper file

2. The jasper file had to be in the WEB-INF folder (eg web/WEB-INF/reports/report.jasper)

3. Images used in the reports had to be in the classes folder (eg web/WEB-INF/classes/img/report.png)

link publish delete flag offensive edit

answered 2010-11-16 16:08:17 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16

updated 2010-11-16 16:08:31 +0800

to 1.) that's a problem from iReport not zk. There are many guys who uses an older version of iReport, because compiling problems.

to 2.) Right

    // Get the real path for the report
    String reportSrc = Sessions.getCurrent().getWebApp().getRealPath("/WEB-INF/reports/order/Test_Report.jasper");


link publish delete flag offensive edit

answered 2010-11-22 13:49:46 +0800

ovazquez gravatar image ovazquez

hi everybody, i have the same trouble, and i think zk is finding the file report (*.jasper), but when zk tries to load the file generated (*.pdf), it can not find it, because the url is looking for, does not exists.

Look the message

message /view/z_0wu/zG8Pnp1/0/report/report2.pdf

the question is, do i need to do something more to show the report?

Example of my code

<div >


Choose a File Type : <listbox id="format" mold="select" >
<listitem label="PDF" value="pdf" selected="true" />
<listitem label="HTML" value="html" />
<listitem label="Word (RTF)" value="rtf" />
<listitem label="Excel" value="xls" />
<listitem label="Excel (JXL)" value="jxl" />
<listitem label="CSV" value="csv" />
<listitem label="OpenOffice (ODT)" value="odt" unless="false" />
<button label="Get Report" onClick='showReport()' />
<jasperreport id="report" height="360px" />
import demo.reporting.jasperreport.CustomDataSource;

void showReport() {
//Preparing parameters
Map parameters = new HashMap();

report.setDatasource(new CustomDataSource());
report.setType((String) format.getSelectedItem().getValue());

all the jasper path file is under WEB-INF, i try at the same level, and inside WEB-INF, folder, but it still sends me

22/11/2010 01:47:36 PM org.zkoss.zk.au.http.AuDynaMediar process:130
GRAVE: Failed to load media, /view/gsjv/z_sj_k/0/jasper/reports/ComisionOficioSolicitud.pdf
>>java.lang.RuntimeException: resource for /jasper/reports/ComisionOficioSolicitud.jasper not found.
>> at org.zkoss.zkex.zul.Jasperreport.doReport(Jasperreport.java:337)
>> at org.zkoss.zkex.zul.Jasperreport.access$100(Jasperreport.java:76)
>> at org.zkoss.zkex.zul.Jasperreport$ExtraCtrl.getMedia(Jasperreport.java:310)
>> at org.zkoss.zk.au.http.AuDynaMediar.process(AuDynaMediar.java:112)
>> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:362)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)


link publish delete flag offensive edit

answered 2010-11-22 17:13:47 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16

updated 2010-11-22 17:14:10 +0800

 // Get the real path for the report
    String reportSrc = Sessions.getCurrent().getWebApp().getRealPath("/WEB-INF/reports/order/Test_Report.jasper");

report.setSrc(reportSrc );


link publish delete flag offensive edit

answered 2011-02-02 07:57:24 +0800

giordan gravatar image giordan
48 2

updated 2011-02-02 07:57:54 +0800

Hello everyone!
Sorry if I answer only now, but I had to interrupt my work on ZK in recent weeks, and I have recently resumed.

Following the suggestions of FujitsuConsulting Stephan I solved my problems.
Here's the simplified version of the class that acts as a controller for the window that displays my report in pdf format.

package ecodata.gestedil.controller;

import org.zkoss.util.media.AMedia;
import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.ext.AfterCompose;
import org.zkoss.zul.*;
import java.sql.Connection;
import java.util.*;
import org.zkoss.zkplus.hibernate.HibernateUtil;
import net.sf.jasperreports.engine.*;

public class LonelyReport  extends Window implements AfterCompose {
	private static final int dbMsgDebug = 1;
	private Iframe ifReport;
	private Textbox txProtocollo;
	String reportSrc = "";
	String basicPath = "/WEB-INF/report/";
	String reportRequired = (Sessions.getCurrent()).getAttribute("reportRequired").toString();
	Long idPratica = Long.valueOf((Sessions.getCurrent()).getAttribute("idPratica").toString());

	String outFileName = reportRequired+"_"+"Pratica";
	public void afterCompose() {
        //wire variables
        Components.wireVariables(this, this);
        //auto forward
        Components.addForwards(this, this);
	private void showReport() {
		HashMap<Object, Object> hm = new HashMap<Object, Object>();
		try {
			// Fill the report using DB connection
			Connection conn = HibernateUtil.currentSession().connection();
			hm.put("ID_PRATICA", idPratica);
			hm.put("PROT", txProtocollo.getValue());
			reportSrc = Sessions.getCurrent().getWebApp().getRealPath(basicPath+reportRequired+".jasper");
			JasperPrint print = JasperFillManager.fillReport(reportSrc, hm, conn);
			if (dbMsgDebug != 0)  System.out.println("Report --> reportSrc = "+reportSrc);

			// Export the PDF file and show it in iFrame
			AMedia am = new AMedia( outFileName+".pdf", null, null, JasperExportManager.exportReportToPdf(print));
		} catch (Exception e) {

	public LonelyReport() {
		// TODO Auto-generated constructor stub

	public LonelyReport(String title, String border, boolean closable) {
		super(title, border, closable);
		// TODO Auto-generated constructor stub


Thanks, best regards,


link publish delete flag offensive edit

answered 2011-10-12 15:36:21 +0800

rgravel gravatar image rgravel
28 5

updated 2011-10-14 12:55:53 +0800


I'm having the same problem generating my PDF file but everything works fine locally. When I deploy on a test server, I get the following error:

HTTP Status 410 - Failed to load /view/z_y9o/.../report/SRDIcontract.pdf
Cause: Unknown hyperlink target 0

Do any of you already had that kind of problem ONLY on a remote server?

Here's my code:

			public void generatePDF(){
				generateContract(contractInfo, "pdf");
			void generateContract(ContractInfo contractInfo, String format){
				String realPath = Executions.getCurrent().getDesktop().getSession().getWebApp().getRealPath("/");
				File img = new File(realPath+File.separator+"media"+File.separator+"images"+File.separator+"cic.gif");
				//calculate the amounts
				double total1= contractInfo.getWorkedHours() * contractInfo.getHourRate();
				double total2 = contractInfo.getCalls() * contractInfo.getCallRate();
				double finalTotal= total1 + total2 + contractInfo.getTravelingFees();
				NumberFormat moneyFormatter = new DecimalFormat("#0.00$");
				NumberFormat numberFormatter = new DecimalFormat("#0.00");
				SimpleDateFormat hourFormat= new SimpleDateFormat("HH:mm");
				//Preparing parameters
				Map parameters = new HashMap();
				parameters.put("logo", img);

				parameters.put("name", contractInfo.getInterpreter().getFirstname() + " " + contractInfo.getInterpreter().getLastname() );
				parameters.put("adresse1-2", (contractInfo.getInterpreter().getStreet()!=null? contractInfo.getInterpreter().getStreet():"") + "  " +  (contractInfo.getInterpreter().getStreet2()!=null? contractInfo.getInterpreter().getStreet2():""));
				if(contractInfo.getInterpreter().getCity().length() == 0){
					parameters.put("city-prov",  (contractInfo.getInterpreter().getProvince()!=null? contractInfo.getInterpreter().getProvince():""));
					parameters.put("city-prov",  contractInfo.getInterpreter().getCity() + (contractInfo.getInterpreter().getProvince()!=null? 
							", " + contractInfo.getInterpreter().getProvince():""));
				parameters.put("postalCode", contractInfo.getInterpreter().getPostalCode());
				parameters.put("fileNumber", (contractInfo.getFileNo()!=null && !contractInfo.getFileNo().equals(0L)) ? contractInfo.getFileNo().toString(): "");
				parameters.put("contractDate", (contractInfo.getContractDate()!=null? new SimpleDateFormat("yyyy-MM-dd").format(contractInfo.getContractDate()):""));
				parameters.put("location", contractInfo.getOffice().getName());			
				parameters.put("period1",(contractInfo.getPeriods()!=null && contractInfo.getPeriods().size()>=1 ? hourFormat.format(contractInfo.getPeriods().get(0).getFrom()) + "-" + hourFormat.format(contractInfo.getPeriods().get(0).getTo()):""));
				parameters.put("period2",(contractInfo.getPeriods()!=null && contractInfo.getPeriods().size()>=2 ? hourFormat.format(contractInfo.getPeriods().get(1).getFrom()) + "-" + hourFormat.format(contractInfo.getPeriods().get(1).getTo()):""));
				parameters.put("period3",(contractInfo.getPeriods()!=null && contractInfo.getPeriods().size()>=3 ? hourFormat.format(contractInfo.getPeriods().get(2).getFrom()) + "-" + hourFormat.format(contractInfo.getPeriods().get(2).getTo()):""));
				parameters.put("period4",(contractInfo.getPeriods()!=null && contractInfo.getPeriods().size()>=4 ? hourFormat.format(contractInfo.getPeriods().get(3).getFrom()) + "-" + hourFormat.format(contractInfo.getPeriods().get(3).getTo()):""));				
				parameters.put("languages", contractInfo.getLanguage().getName());				
				parameters.put("resquestingOffice", contractInfo.getOffice().getId().toString());
				parameters.put("byPhone", (byPhone.isChecked() ? "Par téléphone / By phone" : "X"));
				parameters.put("sin", contractInfo.getInterpreter().getSin()!=null? contractInfo.getInterpreter().getSin().toString(): "");
				parameters.put("hours1", numberFormatter.format(contractInfo.getWorkedHours()));
				parameters.put("hourRate", moneyFormatter.format(contractInfo.getHourRate()));				
				parameters.put("callRate", moneyFormatter.format(contractInfo.getCallRate())); 			
				parameters.put("total1", moneyFormatter.format(total1));
				parameters.put("total2", moneyFormatter.format(total2));
				parameters.put("travelExpenses",  moneyFormatter.format(contractInfo.getTravelingFees()));
				parameters.put("finalTotal", moneyFormatter.format(finalTotal));

			    parameters.put("SUBREPORT_DIR", realPath+File.separator+"report"+File.separator);



P.S. I tried everything that is mentioned in this post. I moved the file to WEB-INF, I installed iReport v3.7, etc. But nothing seems to work.

link publish delete flag offensive edit

answered 2014-11-16 19:28:41 +0800

fedesacaba gravatar image fedesacaba

hi everyone, I have this problem when running the jasper Caused by: net.sf.jasperreports.engine.util.JRFontNotFoundException: Font ' net/sf/jasperreports/fonts/pictonic/pictonic.ttf net/sf/jasperreports/fonts/pictonic/pictonic.svg net/sf/jasperreports/fonts/pictonic/pictonic.eot net/sf/jasperreports/fonts/pictonic/pictonic.woff ' is not available to the JVM. See the Javadoc for more details.

someone can help me

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2010-11-16 08:55:26 +0800

Seen: 1,714 times

Last updated: Nov 16 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More