Jump to content
Changes to the Jaspersoft community edition download ×

Compile error - Please do help


2005 IR Help

Recommended Posts

By: shunbeii - shunbeii

Compile error - Please do help

2004-08-25 01:41

Hi, I've searched through this forum several times (different errors), but i've not been able to find a similar one to this.

 

my build.xml is in directory

C:Program FileseclipseworkspaceReport

 

i've duplicated the sample files over into this directory too. all i'm trying to do now is to run the sample files to figure out how to use jasper reports, but i've been trying for days now and i'm still stuck.

 

i think the error might have something to do with "Parse Error at line 1 column 59: Document root element "project", must match DOCTYPE root "null"."

 

my build.xml:

 

<project name="JasperReports" default="javac" basedir=".">

 

<property name="class.name" value="AlterDesignApp" />

<property name="file.name" value="AlterDesignReport" />

<property name="classes.dir" value="C:Program FilesApache Software FoundationTomcat 5.0webappsfxibgJasper Reportclasses" />

<property name="lib.dir" value="C:Program FilesApache Software FoundationTomcat 5.0webappsfxibgJasper Reportlib" />

<property name="fonts.dir" value="C:Program FilesApache Software FoundationTomcat 5.0webappsfxibgJasper Reportdemofonts" />

 

<path id="classpath">

<pathelement location="./"/>

<pathelement location="${classes.dir}" />

<pathelement location="${fonts.dir}" />

<fileset dir="${lib.dir}">

<include name="**/*.jar"/>

</fileset>

</path>

 

<!--

Compiles the java source files

of the test application.

-->

<target name="javac">

<javac srcdir="./" destdir="./" debug="true" optimize="false" deprecation="false">

<classpath refid="classpath"/>

</javac>

</target>

 

<!--

Compiles the XML report design

and produces the .jasper file.

-->

<target name="compile">

<java classname="${class.name}" fork="true">

<arg value="-Tcompile"/>

<arg value="-F${file.name}.jrxml"/>

<classpath refid="classpath"/>

</java>

</target>

 

 

THE ERROR MSG:

compile:

[java] Aug 25, 2004 4:06:53 PM org.apache.commons.digester.Digester error

[java] SEVERE: Parse Error at line 1 column 59: Document root element "project", must match DOCTYPE root "null".

[java] org.xml.sax.SAXParseException: Document root element "project", must match DOCTYPE root "null".

[java] at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)

[java] at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)

[java] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)

[java] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)

[java] at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)

[java] at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)

[java] at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)

[java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)

[java] at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)

[java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

[java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

[java] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

[java] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

[java] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

[java] at org.apache.commons.digester.Digester.parse(Digester.java:1514)

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:400)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:384)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:338)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:322)

[java] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:105)

[java] at AlterDesignApp.main(AlterDesignApp.java:128)

[java] org.xml.sax.SAXParseException: Document root element "project", must match DOCTYPE root "null".

[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

[java] at org.apache.commons.digester.Digester.parse(Digester.java:1514)

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:400)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:384)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:338)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:322)

[java] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:105)

[java] at AlterDesignApp.main(AlterDesignApp.java:128)

[java] NESTED BY :

[java] org.xml.sax.SAXParseException: Document root element "project", must match DOCTYPE root "null".

[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

[java] at org.apache.commons.digester.Digester.parse(Digester.java:1514)

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:400)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:384)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:338)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:322)

[java] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:105)

[java] at AlterDesignApp.main(AlterDesignApp.java:128)

[java] NESTED BY :

[java] dori.jasper.engine.JRException: Document root element "project", must match DOCTYPE root "null".

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:404)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:384)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:338)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:322)

[java] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:105)

[java] at AlterDesignApp.main(AlterDesignApp.java:128)

[java] Caused by: org.xml.sax.SAXParseException: Document root element "project", must match DOCTYPE root "null".

[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

[java] at org.apache.commons.digester.Digester.parse(Digester.java:1514)

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:400)

[java] ... 5 more

[java] Java Result: 1

compileBsh:

[java] Aug 25, 2004 4:06:56 PM org.apache.commons.digester.Digester error

[java] SEVERE: Parse Error at line 1 column 59: Document root element "project", must match DOCTYPE root "null".

[java] org.xml.sax.SAXParseException: Document root element "project", must match DOCTYPE root "null".

[java] at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)

[java] at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)

[java] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)

[java] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)

[java] at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)

[java] at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)

[java] at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)

[java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)

[java] at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)

[java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

[java] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

[java] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

[java] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

[java] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

[java] at org.apache.commons.digester.Digester.parse(Digester.java:1514)

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:400)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:384)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:338)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:322)

[java] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:105)

[java] at AlterDesignApp.main(AlterDesignApp.java:128)

[java] org.xml.sax.SAXParseException: Document root element "project", must match DOCTYPE root "null".

[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

[java] at org.apache.commons.digester.Digester.parse(Digester.java:1514)

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:400)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:384)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:338)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:322)

[java] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:105)

[java] at AlterDesignApp.main(AlterDesignApp.java:128)

[java] NESTED BY :

[java] org.xml.sax.SAXParseException: Document root element "project", must match DOCTYPE root "null".

[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

[java] at org.apache.commons.digester.Digester.parse(Digester.java:1514)

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:400)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:384)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:338)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:322)

[java] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:105)

[java] at AlterDesignApp.main(AlterDesignApp.java:128)

[java] NESTED BY :

[java] dori.jasper.engine.JRException: Document root element "project", must match DOCTYPE root "null".

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:404)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:384)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:338)

[java] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:322)

[java] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:105)

[java] at AlterDesignApp.main(AlterDesignApp.java:128)

[java] Caused by: org.xml.sax.SAXParseException: Document root element "project", must match DOCTYPE root "null".

[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

[java] at org.apache.commons.digester.Digester.parse(Digester.java:1514)

[java] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:400)

[java] ... 5 more

[java] Java Result: 1

fill:

[java] java.io.FileNotFoundException: AlterDesignReport.jasper

[java] at dori.jasper.engine.util.JRLoader.loadObject(JRLoader.java:117)

[java] at AlterDesignApp.main(AlterDesignApp.java:135)

[java] NESTED BY :

[java] java.io.FileNotFoundException: AlterDesignReport.jasper

[java] at dori.jasper.engine.util.JRLoader.loadObject(JRLoader.java:117)

[java] at AlterDesignApp.main(AlterDesignApp.java:135)

[java] NESTED BY :

[java] dori.jasper.engine.JRException: AlterDesignReport.jasper

[java] at dori.jasper.engine.util.JRLoader.loadObject(JRLoader.java:117)

[java] at AlterDesignApp.main(AlterDesignApp.java:135)

[java] Caused by: java.io.FileNotFoundException: AlterDesignReport.jasper

[java] ... 2 more

[java] Java Result: 1

 

 

Thanks much!!

Shunbeii

 

 

 

 

By: shunbeii - shunbeii

RE: Compile error - Please do help

2004-08-25 02:55

as silly as this sounds. i found the reason for the error. it's because i somehow renamed the .jrxml file.

 

where is this .jrxml file first created? i cannot seem to find it. am i supposed to go to the .java file to create a method similar to "compile" so that i can get a .jrxml file from build.xml??

 

really need an answer. thanks!

 

 

 

 

By: shunbeii - shunbeii

RE: Compile error - Please do help

2004-08-25 01:54

Another thing, i'm actually so new to jasper reports that I'm not even sure what i'm doing is correct.

 

1) initially i couldn't compile build.xml. so i downloaded ireports. but i couldn't figure out how to create charts (which is what i need), so i downloaded eclipse so that i can compile build.xml

 

2) now that i can compile build.xml (halfway), the only file which can be created from build.xml and filename.java is whatever.class. if filename.jasper already exists, then i can get filename.jrprint, but i am unable to generate filename.jasper

 

if the error above is solved, will i be able to generate filename.jasper?

 

I guess if i can at least see how the sample runs, i might be able to figure out how to use it.

 

thanks so much for at least reading!! i've got no idea how to meet my deadline..

 

 

 

 

By: Chuck Deal - cdeal

RE: Compile error - Please do help

2004-08-25 03:56

Well, If you are that new, I would suggest taking a simple approach to the problem and going from there.

 

I would assume that you have already downloaded the JasperReports distribution (the jar, src, and samples)

 

Unzip this somewhere.

 

Make sure that Apache Ant is properly installed. (If you type 'ant -version' at a command prompt and you receive a valid response, it is properly installed)

 

Now, navigate to one of the samples. Somewhere in that directory tree there is a how to file that tells you how to use ant to run the samples.

 

Once you have successfully run the samples (compiled, filled, exported, etc) THEN ypu can try and get fancy and use your own build files, iReport, or Eclipse. Also, using the driver class files from the samples could be a big help for you.

 

NOTE: unless the name of your report is 'build' build.xml is not meant to be compiled, it is the Ant build file.

 

 

 

 

By: shunbeii - shunbeii

RE: Compile error - Please do help

2004-08-31 00:00

yeah. thanks for the advice. i finally managed to compile and create pdfs.. but now i'm hopelessly stuck on an error msg.. it says:

 

dori.jasper.engine.JRException: URI was not reported to parser for entity [document]

 

this is my .java file. basically its a servlet and there's a page that loads it..

 

the problem occurs because of "JasperDesign jasperDesign = JasperManager.loadXmlDesign(xmluri);" where xmluri is the location of the .jrxml file.

 

apparently some parsing needs to be done. i went to do some research and tried adding in a parse method with String SystemId where SystemId is xmluri. but it still doesn't work.

 

any ideas any one?? or is this the wrong method to get everything on display? i just want to get data out from the db and print out on bar charts.. right now, using ireports, i can get data out but somehow i can't see the charts.. (mebbie cos i dunno how to create them correctly) so i'm just using ireports to help me generate the .jrxml file, while i create another .java servlet to compile and fill and create the pdf file..

 

thanks in advance!!

 

 

 

import org.jfree.data.DefaultPieDataset;

import org.jfree.chart.ChartFactory;

import org.jfree.chart.JFreeChart;

import org.jfree.chart.ChartFrame;

 

import dori.jasper.engine.design.JasperDesign;

import dori.jasper.engine.JasperManager;

import dori.jasper.engine.JasperReport;

import dori.jasper.engine.JasperPrint;

import dori.jasper.view.JasperViewer;

 

import java.util.*;

import java.sql.Connection;

import org.apache.log4j.Logger;

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import org.xml.sax.*;

 

public class GetReport extends connpool.HttpServletJXGB implements Serializable

{

 

private static Logger log = Logger.getLogger(GetReport.class.getName());

 

public void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException

{

doGet(request,response);

}

 

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException

{

Connection conn = null;

log.info("in main method");

 

try

{

log.info("//First, load JasperDesign from XML and compile it into JasperReport");

String xmluri="C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\fxibg\iReport-0.3.2\reports\individual.jrxml";

log.info(xmluri);

JasperDesign jasperDesign = JasperManager.loadXmlDesign(xmluri);

log.info("after loading, compiling it");

JasperReport jasperReport = JasperManager.compileReport(jasperDesign);

 

log.info("// Second, create a map of parameters to pass to the report.");

Map parameters = new HashMap();

parameters.put("employeeChart", createEmployeeChartImage());

 

log.info("// Third, get a database connection");

// conn = myBroker.getConnection();

 

log.info("// Fourth, create JasperPrint using fillReport() method");

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

 

log.info("// You can use JasperPrint to create PDF");

JasperManager.printReportToPdfFile(jasperPrint, "C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\fxibg\iReport-0.3.2\reports\GetReport.pdf");

 

log.info("// Or to view report in the JasperViewer");

JasperViewer.viewReport(jasperPrint);

 

}

catch(Exception e)

{

e.printStackTrace();

log.info("getReport.java: " + e);

}

}

 

private static java.awt.Image createEmployeeChartImage()

{

 

log.info("// create a dataset...");

DefaultPieDataset data = new DefaultPieDataset();

data.setValue("Category 1", new Double(43.2));

data.setValue("Category 2", new Double(27.9));

data.setValue("Category 3", new Double(79.5));

 

log.info("// create a chart...");

JFreeChart chart = ChartFactory.createPieChart("Sample Pie Chart", data, true, true, true);

 

log.info("// create and display a frame...");

ChartFrame frame = new ChartFrame("Test", chart);

frame.pack();

frame.setVisible(true);

 

return chart.createBufferedImage(500, 220);

}

 

}

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