views:

200

answers:

3

Sorry for dummy question, but i lost my whole day to start with JasperReport. The problem is that i always receive this exception: "org.xml.sax.SAXParseException: Premature end of file." when i am trying to read .jrxml file. It is not possible to not to be well-formed, because its generated with iReport.

I asked in jasper forums, but no solution up to now. When I searched about this error in web, generally its involved with WebService technologies, but i`m running my app in local db connection without application container. Any ideas?

Thanks in advance.

A: 

You may want to make sure your iReport installation is using an appropriate iText jar. If you are using iReport with JasperServer you will want to verify that both are using the same version of iText. The last time I saw this error in this context it turned out the JasperServer install was using an older version of iText than iReport - and it required the older version. Using the same jar for both products resolved the issue.

spork
I`m not using JasperServer. I just want to made quick start in jasper. It`s the simplest app - main method with loading jrxml file. I moved all of copied ../iReport/libs/*.jar to WORKSPACE/libs/Jasper/ and include them in my project. And result is this stack trace -> http://pastebin.com/m38b7f0c0. My class path is: http://pastebin.com/m11d2ff19 and jrmxl -> http://pastebin.com/m221ce04b. This stupid problem stop my work for 3 days up to now ... Thanks for helping
NikolayGS
It looks like you are using `ant` to build your project. Do you get the same error when running it in Eclipse as you do when running it externally? What versions of iReport and Jasper are you using?
spork
A: 

Did you make the file with iReport and trying to open it in the same iReport or another iReport version?

Possible problems:

  • The file has been made in iReport and opened in another version.
  • The file is made with iReport then the XML source is modified outside iReport.

I hope you have an SVN where a previous version of the files exists, if so, try to compare them. Another suggestion, if the file is on a remote folder (ie. server) copy it to local folder and try.

Another guess, are you trying to compile the file with JasperReports? This is a common problem when the file is made with iReport version and the JasperReport is older or newer. Make sure the jasperreports*.jar files in the iReport directory, are the same as the ones you are using to compile in your project.

UPDATE: Take a look here at JavaForums, a missing xsd/dtd or saaj.jar could cause this problem.

medopal
I have only one version of iReport and xml file want even opened in redactor. And yes japerreports jar is copy->pasted from iReport/libThanks for helping
NikolayGS
A: 

The version of JasperReports in your application is probably different than the one in your application.

muximux