2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Steve Leach - steve_leach Cannot compile reports 2003-08-12 10:21 Hello all I've had a quite a frustrating day today trying to get jasper up and running for the first time. I just can't seem to be able to reliably compile reports. I have never managed to get the ant task to work, and have also tried the Tomcat servlet approach which works every now and then, but fails most of the time. When trying to compile with ant I get java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester I have added the Digester jar file in the classpath of both the taskdef and the jrc tasks. The documentation is almost useless in this respect, even the so-called "ultimate guide" that I paid good money for. Could someone please give me a step-by-step guide for compiling reports ? I'm getting close to giving up here. Cheers Steve By: Gregory A. Swarthout - gswarthout RE: Cannot compile reports 2003-08-12 10:27 <path id="reports.classpath"> <fileset dir="${jasperDir}/lib"/> <fileset dir="${jasperDir}/dist"/> </path> <taskdef name="jrc" classname="dori.jasper.ant.JRAntCompileTask"> <classpath refid="reports.classpath"/> </taskdef> <target name="compile-reports" depends="prepare"> <jrc destdir="${jasperOut}"> <src> <fileset dir="${jasperDefs}"/> </src> <classpath refid="reports.classpath"/> </jrc> </target> By: Steve Leach - steve_leach RE: Cannot compile reports 2003-08-12 10:37 Wow - that was quick, thanks. Unfortunately I still get the same error. ----------- from web.xml ------------- <property name="jasperDir" value="/usr/java/jasperreports-0.5.0" /> <property name="jasperDefs" value="./reports" /> <property name="jasperOut" value="./reports" /> <path id="reports.classpath"> <fileset dir="${jasperDir}/lib"/> <fileset dir="${jasperDir}/dist"/> </path> <taskdef name="jrc" classname="dori.jasper.ant.JRAntCompileTask"> <classpath refid="reports.classpath"/> </taskdef> <target name="prepare" /> <target name="compile-reports" depends="prepare"> <jrc destdir="${jasperOut}"> <src> <fileset dir="${jasperDefs}"/> </src> <classpath refid="reports.classpath"/> </jrc> </target> ----------------------------- In my jasper reports lib directory I have [steve@kily reports]$ ls /usr/java/jasperreports-0.5.0/lib ant-1.5.1.jar commons-logging-1.0.2.jar jakarta-poi-1.5.1-final-20020615.jar LICENSE.itext.txt xmlParserAPIs.jar bsh-1.2b6.jar commons-logging-api-1.0.2.jar LICENSE.ant.txt LICENSE.poi.txt commons-beanutils-1.5.jar COPY.tools.jar.HERE.txt LICENSE.bsh.txt LICENSE.xerces.txt commons-collections-2.1.jar hsqldb-1.61.jar LICENSE.commons.txt servlet.jar commons-digester-1.3.jar itext-0.96.jar LICENSE.hsqldb.txt xercesImpl.jar The error is BUILD FAILED java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester By: Gregory A. Swarthout - gswarthout RE: Cannot compile reports 2003-08-12 10:54 This is perplexing. The Ant fragment I gave you is exactly what we are using. Do you have the full stack trace of the error? By: Steve Leach - steve_leach RE: Cannot compile reports - partially solved 2003-08-12 10:58 I forgot to mention that I was using AntFarm (inside JEdit) rather than Ant directly. I have just downloaded the standalone version of Ant and run the build with that and it worked fine. At least I have a temporary solution, though I'd like to get everything running under AntFarm as it is so convenient. Thanks for your help anyway, Steve The full stack-trace, in case you are still interested, is below... --------------------------------- BUILD FAILED java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.lang.ClassLoader.defineClass(ClassLoader.java:448) at org.gjt.sp.jedit.JARClassLoader._loadClass(Unknown Source) at org.gjt.sp.jedit.JARClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at dori.jasper.engine.xml.JRXmlLoader.prepareDigester(JRXmlLoader.java:428) at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:370) at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:357) at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:337) at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:323) at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:121) at dori.jasper.ant.JRAntCompileTask.compile(JRAntCompileTask.java:391) at dori.jasper.ant.JRAntCompileTask.execute(JRAntCompileTask.java:239) at org.apache.tools.ant.Task.perform(Task.java:319) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:336) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at antfarm.TargetRunner.runAntTarget(Unknown Source) at antfarm.TargetRunner.run(Unknown Source) By: David Hardwick - dhardwick RE: Cannot compile reports - partially solved 2003-08-12 11:11 Also, you should _COPY_ the Tools.jar file (from JRE lib) into your lib dir. Note the file that is named Copy_tools.jar_here.txt I've had similiar problems using ant scripts within Eclipse, best to stick with the command line so you can have complete and easy-to-debug control over the environment. The guide is a great purchase, I spent two days reading it. After that, you really need to dig into the examples to help retain and articulate everything you just read. By: Steve Leach - steve_leach RE: Cannot compile reports - partially solved 2003-08-12 11:56 Strangely I haven't had to copy tools.jar to get the stand-alone ant version running, although it was in my lib directory for the AntFarm version. One of the nice things about AntFarm (apart from just hitting F5 to build when editing) is that I can specify all the Ant configuation within the Jedit global properties. Oh, and it takes me directly to the lines that contain errors; and formats the errors in a nice tree structure; and... I think I'm going to stick with 2 different build.xml files, one for stuff which AntFarm can handle, and one for the other stuff. As for the guide - it is a nice reference but it is not a tutorial or user guide by any means. Take the section on compiling reports - it starts by saying that this should be a design-time task and then doesn't mention how this can be done. Anyway, I'm making progress now. Thanks again for all the help. 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