frequent asked questions
 version 0.5.2
 
 

 
 

INDEX

 
  1. System property org.xml.sax.driver not specified
2. Swing application exits when closing the JasperViewer frame
3. Cannot use the && logical operator in report expressions
4. java.io.InvalidClassException: ... serialVersionUID = xxx ...
5. Images are not appearing in XLS format

         
 1. System property org.xml.sax.driver not specifiedtop 
 
 JasperReports uses the SAX 2.0 API to parse the XML files. However, it is not tied to a particular SAX 2.0 implementation, like Xerces for examples, but instead you are able to decide at runtime what XML parser you are using.
 
 To instantiate the parser class, JasperReports uses the createXMLReader() method of the org.xml.sax.helpers.XMLReaderFactory class.
 In this case, it will be necessary at runtime to set the org.xml.sax.driver Java system property to the full class name of the SAX driver, as specified in the SAX 2.0 documentation.
 
 You can achieve this in two ways. We shall explain both using the Xerces XML parser, just like we do it in the provided samples. If you use a different SAX 2.0 XML parser, you have to modify the name of the parser class accordingly.
 
 The first way you can set a system property is by using the -D switch in the command line when you launch the Java Virtual Machine:
 
 
java -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser 
    MySAXApp sample.xml
  
 In all the provided samples we use the ANT build tool to perform different tasks. We supply this system property to the JVM using the <sysproperty> element of the <java> built-in task:
 
 
<sysproperty 
    key="org.xml.sax.driver" 
    value="org.apache.xerces.parsers.SAXParser"/>
  
 The second way to set a system property is by using the java.lang.System.setProperty(String key, String value) method like this:
 
 
System.setProperty(
    "org.xml.sax.driver", 
    "org.apache.xerces.parsers.SAXParser"
    );
  
 Check the jsp/compile.jsp and WEB-INF/classes/servlets/CompileServlet.java files in the "webapp" sample provided, to see this in action.
 
 2. Swing application exits when closing the JasperViewer frametop 
 
 This happens if you directly use the dori.jasper.view.JasperViewer class in your Swing application.
 
 The viewer application implemented in this class should be considered more like a demo application that shows how the dori.jasper.view.JRViewer component can be used in Swing applications to display reports.
 Your application unexpectedly terminates when you close the report viewer frame because the JasperViewer class makes a call to the System.exit(0).
 To get around this, use the constructor that allows you to set the "isExitOnClose" to false.
 
 But you are encouraged to create your own viewer that uses the more basic visual component implemented by the dori.jasper.view.JRViewer class. Feel free to copy what code portion you might want to keep from the supplied JasperViewer class.
 
 3. Cannot use the && logical operator in report expressionstop 
 
 If you want to create some complex report expressions in which you have to use the Java AND logical operator, you might be surprised to see an error when compiling you report design. The error message would say something like this:
 
 "The entity name must immediately follow the '&' in the entity reference."
 
 Don't worry! This is because the '&' character is a special XML character and the XML parser is confused when it encounters such characters in the body of an XML element.
 The solution is to use the XML special syntax that allows you to introduce XML special characters in the body of an XML element. Put your expression content between the <![CDATA[ and ]]> character sequences like in the following demo text field expression:
 
 
 0)?
    ($F{MyStringField}):("MISSING")
  ]]>
</textFieldExpression>
  ]]>
 4. java.io.InvalidClassException: ... serialVersionUID = xxx ...top 
 
 When upgrading to a new version of the library, you need to recompile your XML report design and regenerate the *.jasper files.
 
 5. Images are not appearing in XLS formattop 
 
 The Jakarta POI library that we use when exporting the report to XLS format does not currently supports images.
 



Copyright © 2001-2004 Teodor Danciu teodord@users.sourceforge.net