Jump to content
We've recently updated our Privacy Statement, available here ×

Unable to run Subreport on iReport version 3.5.0


srikuba

Recommended Posts

Hello,

I was trying to use a subreport with an older version of iReport 2.0.4. I had few problems like 'Could not load object from location..'. I could resolve that by upgrading to the newer version of iReport and ive copied the jasper report jar as well for the lastest version.

After the upgrade I no more have the previous error message but the application is throwing the following message.

My jrxml file starts with the following lines.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="reportName" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20">

The exception says 'xmlns' must be declared although I have it declared.

 [java] 2009-03-30 15:20:26,860 [AWT-EventQueue-0] ERROR org.apache.commons.digester.Digester - Parse Error at line 4 column 273: Attribute "xmlns" must be declared for element type "jasperReport".
     [java] org.xml.sax.SAXParseException: Attribute "xmlns" must be declared for element type "jasperReport".
     [java]     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
     [java]     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
     [java]     at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(XMLDTDValidator.java:1306)
     [java]     at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1971)
     [java]     at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:795)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:878)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:1157)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)

 

Any suggestion will be of great help.

 

Thanks

Sri
 

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 month later...

If I take out the line <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
, I get the following error message on report compilation: [jrc] net.sf.jasperreports.engine.JRException: No report compiler set for language : null

iReport 3.5.0 compiles reports OK, but when I try to compile them with ant, I get one of these messages. Never have managed to go past them.

Reports compile and run OK with 2.0.2 version. I would like to pass to v. 3.5.0 to be able to use javascript. What should be modified in build.xml file or somwhere else to be able to compile correctly?

 


 

Link to comment
Share on other sites

Lucian,

I have used two versions, 3.5.0 and now 3.5.1 . Reports created with iReport 2.0.2 compile OK. Reports 2.0.2 retouched with iReport 3.5.x do not.

I have compared JRXML files for the same report (I attach both versions of the same report).

2.0.2:

<?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="DossiersEtapeDocuments"

        ....
 

3.5.x:

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="DossiersEtapeDocuments" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
 

Regards.

Igor

Link to comment
Share on other sites

Hello,

 

Also the subreports seems to work fine when run locally. But I need to place the code on a remote machine. When i do this, the main report complains that it cannot find the sub report. Is there anything obvious that I am missing.

It is running ok on my machine. Do we need to set anything on remote machine for my subreports to work?

 

Thanks

Link to comment
Share on other sites

srikuba,

You have to pass SUBREPORT_DIR from parent to children reports.

Also, I add the following line in HttpServlet's doGet method:

        parameterMap.put("SUBREPORT_DIR", reportLocation.toString() + "/");

Igor
 

Link to comment
Share on other sites

  • 3 years later...

Hi Prosvet / Lucian;

Can you please let me know what changes you made?  I am having the same issue.

  1. I was using jasperreports0.5 earlier and upgraded to jasperreports3.0
  2. I'm using ireport3.0 and i can open xml file in irport and can compile reports after modifing from irport.
  • I want to make some general changes in report xml files.  so i written java program to make these changes using Jasper API and saving back to same file.
  • When i save these file after changes,  it removes DOCTYPE tag and adding xmlns tags.
  • This is creating problem in compilation.   Stacktrace is shown below:

 

     [java]  jasper compile for: ReportTransactionStatement_India.xml
     [java] net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException: Attribute "xmlns" is not declared for element "jasperReport"
     [java]     at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243)
     [java]     at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
     [java]     at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
     [java]     at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:168)
     [java]     at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:152)
     [java]     at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:89)
     [java]     at com.applied.fincrm.utils.JasperCompiler.main(JasperCompiler.java:155)
     [java] Caused by: org.xml.sax.SAXParseException: Attribute "xmlns" is not declared for element "jasperReport".
     [java]     at org.apache.crimson.parser.Parser2.error(Parser2.java:3160)
     [java]     at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1411)
     [java]     at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
     [java]     at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
     [java]     at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
     [java]     at org.apache.commons.digester.Digester.parse(Digester.java:1647)
     [java]     at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:239)
     [java]     ... 6 more
 
Instant help required on this..  Please let me know if you know anything..
Link to comment
Share on other sites

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