prkothan Posted April 15, 2009 Share Posted April 15, 2009 Hi,We are currently using ant task (net.sf.jasperreports.ant.JRAntCompileTask) to compile out 150 more reports. And we are migrating from 2.0.5. Ant task works properly with 2.0.5 and 3.1.0. But its doesn't works with Jasper reports 3.5.0.And it doesn't works for the version 3.1.1 or greater. But we able to compile the reports programmatically using java file or via ireports. And its run properly while generating reports. Just ant task compilation is not working.We are getting following exception. jasper-report: [jrc] 20:05:59,639 DEBUG sax:1249 - setDocumentLocator(com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser$LocatorProxy@1117a20) [jrc] 20:05:59,639 DEBUG sax:1283 - startDocument() [jrc] 20:06:00,030 DEBUG sax:1318 - startElement(,jasperReport,jasperReport) [jrc] 20:06:00,046 DEBUG Digester:1325 - Pushing body text '' [jrc] 20:06:00,046 DEBUG Digester:1344 - New match='jasperReport' [jrc] 20:06:00,046 DEBUG Digester:1359 - Fire begin() for FactoryCreateRule[className=net.sf.jasperreports.engine.xml.JasperDesignFactory, attributeName=null] [jrc] 20:06:00,046 DEBUG Digester:486 - [FactoryCreateRule]{jasperReport} New factory net.sf.jasperreports.engine.xml.JasperDesignFactory [jrc] 20:06:00,046 ERROR Digester:1363 - Begin event threw exception [jrc] java.lang.ClassNotFoundException: net.sf.jasperreports.engine.xml.JasperDesignFactory Post Edited by Prasanna Kothandaraman at 04/16/09 12:29 Link to comment Share on other sites More sharing options...
prkothan Posted April 16, 2009 Author Share Posted April 16, 2009 Identified the cause, but issue is not resolved.Cause is, from Jasper 3.1.1, JRXMLDesignFactory.java has enabled usage of contextClassLoader in the method configureDigester. digester.setUseContextClassLoader(true); As described in below links, Ant doesn't set the context classloader before invoking a task. http://webui.sourcelabs.com/ant/issues/36717https://issues.apache.org/bugzilla/show_bug.cgi?id=36717https://issues.apache.org/bugzilla/show_bug.cgi?id=15018And this should be taken care by customTask (JRAntCompileTask). Actually execute() method set the contextClassLoader, still its not sufficient.Please reply. Regards,Prasanna Link to comment Share on other sites More sharing options...
prkothan Posted April 16, 2009 Author Share Posted April 16, 2009 Adding this line in compile () method of JRAntCompileTask.java class solved the issue.Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); Regards,Prasanna Link to comment Share on other sites More sharing options...
lucianc Posted April 17, 2009 Share Posted April 17, 2009 Log this as a bug.We might need to change the digester code to use a fallback classloader that can resolve classes from both the thread classloader and from getClass().getClassloader().Regards,Lucian 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