Jump to content
Changes to the Jaspersoft community edition download ×

More Info On Compile Error


2005 IR Help

Recommended Posts

By: Tim Martens - victim04

More Info On Compile Error

2004-03-03 07:27

Thanks for the previous help!

 

Now I get the following error when I try to compile my report:

 

JasperReports encountered this error :

dori.jasper.engine.JRException: Errors were encountered when compiling report expressions class file:

See error messages above.

at dori.jasper.engine.design.JRAbstractJavaCompiler.compileReport(JRAbstractJavaCompiler.java:154)

at dori.jasper.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:136)

at dori.jasper.engine.JasperCompileManager.compileReport(JasperCompileManager.java:196)

at dori.jasper.engine.JasperManager.compileReport(JasperManager.java:982)

at misc.test.execute(test.java:53)

 

Again, I'd appreciate whatever help you could offer.

 

Thanks,

Tim

 

My report XML is:

 

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd";>

<jasperReport

name="TimsTest"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="612"

pageHeight="792"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<queryString><![CDATA[select projectStatus from project]]></queryString>

<field name="projectStatus" class="java.lang.String">

</field>

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="50" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="50" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="30" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="100" isSplitAllowed="true" >

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Opaque"

x="12"

y="6"

width="112"

height="24"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font fontName="SansSerif" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{projectStatus}]]></textFieldExpression>

</textField>

</band>

</detail>

<columnFooter>

<band height="30" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="50" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="50" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

and my java file is:

 

/*

* test.java

*

* Created on March 1, 2004, 6:29 PM

*/

 

package misc;

 

import dori.jasper.engine.*;

import dori.jasper.engine.data.*;

import dori.jasper.engine.design.*;

import dori.jasper.engine.export.*;

import dori.jasper.engine.util.*;

import dori.jasper.view.*;

import dori.jasper.engine.*;

import java.io.*;

import java.awt.*;

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;

import org.apache.struts.action.*;

import java.sql.*;

import utilities.*;

import crud.*;

import beans.*;

 

/**

*

* @author My Computer

*/

public final class test extends Action

{

 

public ActionForward execute( ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response) throws IOException

{

ActionForward nextPage = null;

TextLogger.debug("Inside test.java");

DBConnectionManager conMan = null;

Connection dbConn = null;

try

{

TextLogger.debug("Inside test.java TRY block");

conMan = DBConnectionManager.getInstance();

dbConn = conMan.getConnection("poolname");

String reportName = "TimsTest.xml";

String reportFile = "E:\Program Files\jakarta-tomcat-4.1.12\webapps\csn\WEB-INF\classes\misc\"+reportName;

// First, load JasperDesign from XML and compile it into JasperReport

JasperDesign jasperDesign = JasperManager.loadXmlDesign(reportFile);

TextLogger.debug("Load XML design.");

JasperReport jasperReport = JasperManager.compileReport(jasperDesign);

TextLogger.debug("Compiled report.");

// Second, create a map of parameters to pass to the report.

Map parameters = new HashMap();

TextLogger.debug("Map parameters.");

//parameters.put("ReportTitle", "Basic JasperReport");

//parameters.put("MaxSalary", new Double(25000.00));

 

// Third, get a database connection

//Connection conn = Database.getConnection();

 

// Fourth, create JasperPrint using fillReport() method

JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, parameters, dbConn);

TextLogger.debug("fillReport");

 

// You can use JasperPrint to create PDF

JasperManager.printReportToPdfFile(jasperPrint, "E:\Program Files\jakarta-tomcat-4.1.12\webapps\csn\WEB-INF\classes\misc\BasicReport.pdf");

 

// Or to view report in the JasperViewer

JasperViewer.viewReport(jasperPrint);

nextPage = mapping.findForward("success");

}

catch(JRException jre)

{

TextLogger.error("Error: " + jre);

response.setContentType("text/html");

PrintWriter out = response.getWriter();

out.println("<html>");

out.println("<head>");

out.println("<title>JasperReports - Web Application Sample</title>");

out.println("<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">");

out.println("</head>");

 

out.println("<body bgcolor="white">");

 

out.println("<span class="bnew">JasperReports encountered this error :</span>");

out.println("<pre>");

 

jre.printStackTrace(out);

 

out.println("</pre>");

 

out.println("</body>");

out.println("</html>");

 

//nextPage = mapping.findForward("failure");

}

catch(Exception e)

{

TextLogger.error("Error: " + e.getMessage());

nextPage = mapping.findForward("failure");

}

conMan.freeConnection("poolname", dbConn);

return nextPage;

}

 

}

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...