| Author |
Jasper and Eclipse
|
d. m.
Greenhorn
Joined: Nov 01, 2006
Posts: 2
|
|
Hi! I tryed to run Jasper Report from Eclipse RCP plugin application, but some problems occured. net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: C:\NEclipse\classic_1162406069063_403217.java:4: package net.sf.jasperreports.engine does not exist import net.sf.jasperreports.engine.*; where C:\NEclipse in the folder where Eclipse is installed. I use code like this : Connection conn; Map parameters = new HashMap(); parameters.put("Title", "Test Article report"); Statement stmt; try { try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } conn = DriverManager.getConnection("jdbc:postgresql:POS", "user", "pwd"); JasperDesign jasperDesign; try { jasperDesign = JasperManager.loadXmlDesign("c:\\classic.jrxml"); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); //JasperReport jasperReport = JasperManager.loadReport("c:\\classic.jasper"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn); JasperViewer.viewReport(jasperPrint); } catch (JRException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } stmt.close(); conn.close(); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } when I try to use compiled report, so do not compile it, I receive another error: Unhandled event loop exception Reason: net/sf/jasperreports/engine/fill/JRFillParameter Any ideas how to do it to work (considering that required jars had attached to the RCP application) I had another test app, which in not eclipse plugin , and from there it works, and shows the report. So I suppouse that problem is with the setup of compile paths, classpath, eth... Any Ideas? [ November 01, 2006: Message edited by: d. m. ]
|
 |
d. m.
Greenhorn
Joined: Nov 01, 2006
Posts: 2
|
|
here is xml for classic.jrxml: <?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="classic" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false"> <property name="ireport.scriptlethandling" value="0" /> <property name="ireport.encoding" value="UTF-8" /> <import value="java.util.*" /> <import value="net.sf.jasperreports.engine.*" /> <import value="net.sf.jasperreports.engine.data.*" /> <parameter name="Title" isForPrompting="false" class="java.lang.String"> <defaultValueExpression ><![CDATA[" "]]></defaultValueExpression> </parameter> <queryString><![CDATA[select * from tb_article]]></queryString> <field name="art_id" class="java.lang.String"/> <field name="art_name" class="java.lang.String"/> <field name="art_comment" class="java.lang.String"/> <background> <band height="0" isSplitAllowed="true" > </band> </background> <title> <band height="50" isSplitAllowed="true" > <line direction="TopDown"> <reportElement x="0" y="48" width="534" height="0" key="line"/> <graphicElement stretchType="NoStretch"/> </line> <line direction="TopDown"> <reportElement x="0" y="3" width="534" height="0" key="line"/> <graphicElement stretchType="NoStretch"/> </line> <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="230" y="14" width="100" height="18" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$P{Title}]]></textFieldExpression> </textField> </band> </title> <pageHeader> <band height="10" isSplitAllowed="true" > <line direction="BottomUp"> <reportElement x="0" y="9" width="535" height="0" key="line"/> <graphicElement stretchType="NoStretch"/> </line> </band> </pageHeader> <columnHeader> <band height="0" isSplitAllowed="true" > </band> </columnHeader> <detail> <band height="69" isSplitAllowed="true" > <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="127" y="2" width="398" height="17" forecolor="#000000" backcolor="#FFFFFF" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font size="12"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{art_id}]]></textFieldExpression> </textField> <staticText> <reportElement x="0" y="2" width="178" height="17" forecolor="#000000" backcolor="#FFFFFF" key="staticText" positionType="Float"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font size="12"/> </textElement> <text><![CDATA[art_id]]></text> </staticText> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="127" y="21" width="398" height="17" forecolor="#000000" backcolor="#FFFFFF" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font size="12"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{art_name}]]></textFieldExpression> </textField> <staticText> <reportElement x="0" y="21" width="178" height="17" forecolor="#000000" backcolor="#FFFFFF" key="staticText" positionType="Float"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font size="12"/> </textElement> <text><![CDATA[art_name]]></text> </staticText> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="127" y="40" width="398" height="17" forecolor="#000000" backcolor="#FFFFFF" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font size="12"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{art_comment}]]></textFieldExpression> </textField> <staticText> <reportElement x="0" y="40" width="178" height="17" forecolor="#000000" backcolor="#FFFFFF" key="staticText" positionType="Float"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font size="12"/> </textElement> <text><![CDATA[art_comment]]></text> </staticText> </band> </detail> <columnFooter> <band height="0" isSplitAllowed="true" > </band> </columnFooter> <pageFooter> <band height="27" isSplitAllowed="true" > <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="325" y="4" width="170" height="19" forecolor="#000000" backcolor="#FFFFFF" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement textAlignment="Right"> <font size="10"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="499" y="4" width="36" height="19" forecolor="#000000" backcolor="#FFFFFF" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font size="10"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression> </textField> <line direction="TopDown"> <reportElement x="0" y="3" width="535" height="0" key="line"/> <graphicElement stretchType="NoStretch"/> </line> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="1" y="6" width="209" height="19" forecolor="#000000" backcolor="#FFFFFF" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font size="10"/> </textElement> <textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression> </textField> </band> </pageFooter> <summary> <band height="0" isSplitAllowed="true" > </band> </summary> </jasperReport> [ November 01, 2006: Message edited by: d. m. ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
"d. m.", There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it. In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Thanks! bear JavaRanch Sheriff
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: Jasper and Eclipse
|
|
|