skipr Posted March 23, 2011 Share Posted March 23, 2011 Hello!We have an application that generates a jrxml, then compiles it (to jasper) and then fills it. It works ok as a desktop application, but in Web Start version (with jnlp) things go wrong. It looks like the problem is out of our reach, inside the jasperreports jar (we tried 4.0.0 and 4.0.1).We created a proof of concept for this issue to demostrate two scenarios:1. Working: The report is read from jasper file. It works, as a result we get a preview (Hello World).2. Not working: Same code as before, only we read jrxml file and try to compile it. It stops with the error in appendix 1. Look like the XML parser is trying to read the xsd from jar but can't find it. We had a similar issue in our product, we read the resource in the wrong way. We can provide our solution for that case if needed.Again, both cases work in desktop app, only the first (the one that doesn't have to compile the jrxml to jasper) works from jnlp.Please help us with a fix or at least with a workaround, for us it is quite an urgent and important matter.Thank you,Aljoša APPENDIX 1:23.3.2011 13:34:22 org.apache.commons.digester.Digester errorSEVERE: Parse Error at line 6 column 36: schema_reference.4: Failed to read schema document 'jar:http://www.xxxxx.com/test/lib%5Cjasperreports-4.0.1.jar!/net/sf/jasperreports/engine/dtds/jasperreport.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'jar:http://www.xxxxx.com/test/lib%5Cjasperreports-4.0.1.jar!/net/sf/jasperreports/engine/dtds/jasperreport.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(Unknown Source) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(Unknown Source) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(Unknown Source) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown Source) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1647) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:241) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:228) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:216) at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:199) at test.Main.main(Main.java:20) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.doLaunchApp(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Code:The source Main.java:package test;import java.io.InputStream;import java.util.HashMap;import net.sf.jasperreports.engine.JREmptyDataSource;import net.sf.jasperreports.engine.JasperCompileManager;import net.sf.jasperreports.engine.JasperFillManager;import net.sf.jasperreports.engine.JasperPrint;import net.sf.jasperreports.engine.JasperReport;import net.sf.jasperreports.view.JasperViewer;public class Main { public static void main(String[] args) { System.setProperty("jasper.reports.compiler.class", "net.sf.jasperreports.engine.design.JRJdtCompiler"); JasperReport jasperReport; JasperPrint jasperPrint; try { InputStream is = Main.class.getClassLoader().getResourceAsStream("reports/jasperreports_demo.jrxml"); jasperReport = JasperCompileManager.compileReport(is); jasperPrint = JasperFillManager.fillReport( jasperReport, new HashMap(), new JREmptyDataSource());// InputStream is = Main.class.getClassLoader().getResourceAsStream("reports/jasperreports_demo.jasper");// jasperPrint = JasperFillManager.fillReport(// is, new HashMap(), new JREmptyDataSource()); JasperViewer jv = new JasperViewer(jasperPrint, false); jv.setAlwaysOnTop(true); jv.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }}The test.jnlp:<?xml version="1.0" encoding="UTF-8"?><jnlp spec="6.0+" codebase="http://www.xxxxx.com/test" href="Test1.jnlp"> <information> <title>Test jrxml</title> <vendor>XXXX</vendor> <offline-allowed/> </information> <security> <all-permissions/> </security> <resources> <j2se version="1.6+" java-vm-args="-esa -Xnoclassgc"/> <jar href="Test1.jar"/> <jar href="lib\commons-beanutils-1.8.0.jar"/> <jar href="lib\commons-collections-2.1.1.jar"/> <jar href="lib\commons-digester-1.7.jar"/> <jar href="lib\commons-logging-1.0.4.jar"/> <jar href="lib\iText-2.1.7.jar"/> <jar href="lib\jasperreports-4.0.1.jar"/> <jar href="lib\jasperreports-fonts-4.0.1.jar"/> <jar href="lib\jdt-compiler-3.1.1.jar"/> </resources> <application-desc/></jnlp> Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now