xujin_helen Posted July 26, 2012 Share Posted July 26, 2012 Hi,I am using Eclipse Helios with Jaspersoft Studio 1.1.1.Basically, when I preview report, I can't include groovy jar; however, when I use Java to generate pdf, I need that lib. This is inconvenient to include and exclude during different time within the same project.When I Preview Report.jrxml, it will throw below error when I INCLUDE groovy-all-1.7.5.jarjava.lang.LinkageError: loader constraint violation: loader (instance of java/net/URLClassLoader) previously initiated loading for a different type with name "groovy/lang/MetaClass" at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getDeclaredMethods(Class.java:1791) at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:83) at java.security.AccessController.doPrivileged(Native Method) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:80) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:78) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:249) at groovy.lang.MetaClassImpl.addInterfaceMethods(MetaClassImpl.java:365) at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:289) at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2920) at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:166) at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:182) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:210) at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:751) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.initMetaClass(ScriptBytecodeAdapter.java:782) at Blank32A4_1343323737956_48756.$getStaticMetaClass(calculator_Blank32A4_1343323737956_48756) at Blank32A4_1343323737956_48756.<init>(calculator_Blank32A4_1343323737956_48756:18) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.loadEvaluator(JRAbstractJavaCompiler.java:112) at net.sf.jasperreports.engine.design.JRAbstractCompiler.loadEvaluator(JRAbstractCompiler.java:333) at net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(JasperCompileManager.java:265) at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:457) at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:379) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61) at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153) at net.sf.jasperreports.engine.fill.BaseFillHandle.<init>(BaseFillHandle.java:75) at net.sf.jasperreports.engine.fill.AsynchronousFillHandle.<init>(AsynchronousFillHandle.java:98) at net.sf.jasperreports.engine.fill.AsynchronousFillHandle.<init>(AsynchronousFillHandle.java:87) at net.sf.jasperreports.engine.fill.AsynchronousFillHandle.createHandle(AsynchronousFillHandle.java:189) at com.jaspersoft.studio.editor.preview.view.control.ReportControler$2.run(ReportControler.java:245) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)When I run a java class that uses Report2.jrxml to generate pdf, it will throw below exception if I EXCLUDE groovy-all-1.7.5.jar.Exception in thread "main" java.lang.NoClassDefFoundError:org/codehaus/groovy/control/CompilationFailedExceptionat java.lang.Class.forName0(at java.lang.Class.forName(at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(at net.sf.jasperreports.engine.JasperCompileManager.compile(at net.sf.jasperreports.engine.JasperCompileManager.compileReport(at PDFGeneration.main(Caused by:Native Method)Class.java:247)JRClassLoader.java:157)JRClassLoader.java:115)JasperCompileManager.java:736)JasperCompileManager.java:240)JasperCompileManager.java:496)PDFGeneration.java:29)java.lang.ClassNotFoundException: org.codehaus.groovy.control.CompilationFailedExceptionat java.net.URLClassLoader$1.run(at java.security.AccessController.doPrivileged(at java.net.URLClassLoader.findClass(at java.lang.ClassLoader.loadClass(at sun.misc.Launcher$AppClassLoader.loadClass(at java.lang.ClassLoader.loadClass(... 8 moreURLClassLoader.java:202)Native Method)URLClassLoader.java:190)ClassLoader.java:307)Launcher.java:301)ClassLoader.java:248)Thanks,Jin Link to comment Share on other sites More sharing options...
Massimo Rabbi Posted July 30, 2012 Share Posted July 30, 2012 Hi Jin,could you please write down the following additional information: what are the steps you take to add jars to build path which are the jars you have in your build path once you've performed these steps is the project containing the report and PDFGenerator class, a JasperReport project or do you have added the JasperReport nature to an existing one? could attacch .project and .classpath file I've tried to reproduce your problem using your Java file and JRXML file.However I was able to run both the preview and generate the pdf file via java code (see attached screenshot). Best regards,Massimo. Link to comment Share on other sites More sharing options...
xujin_helen Posted July 31, 2012 Author Share Posted July 31, 2012 Hi Massimo,what are the steps you take to add jars to build pathIn eclipse, right click the project => select Properties => select Java Build Path from left pane => click Add External JARs button.which are the jars you have in your build path once you've performed these stepsBelow are the libraries I currently have. All are from Jaspersoft standalone installation. At the beginning, I only add jasperreports-4.6.0.jar. Based on every compile error, I add below rest libraries. I am not sure whether Jasper support maven repository.commons-beanutils-1.8.0.jarcommons-collections-2.1.1.jarcommons-digester-2.1.jarcommons-logging-1.1.1.jariText-2.1.7.jarjasperreports-4.6.0.jaris the project containing the report and PDFGenerator class, a JasperReport project or do you have added the JasperReport nature to an existing one?Yes, one project contains both reports jrxml and java.could attacch .project and .classpath file Please see attached.Thanks,Jin Link to comment Share on other sites More sharing options...
Massimo Rabbi Posted August 1, 2012 Share Posted August 1, 2012 Hi Jin,I tried to extend the tests and I was able to reproduce the problems in JSS 1.1.1, but not in JSS 1.1.2.I'm quite confident the error you got has been fixed with the latest release 1.1.2. Some modifications and improvements were introduced, also related to ClassLoading (JavaProjectClassLoader class was modified).Please try to upgrade to latest 1.1.2 and verify if the problem disappears.Best Regards,Massimo Link to comment Share on other sites More sharing options...
xujin_helen Posted August 1, 2012 Author Share Posted August 1, 2012 Hi Massimo,You are right. After installing 1.1.2, this problem is gone. Thanks for the tip.Right now I have another problem with barcode. I will create a new ticket.Thanks,Jin Link to comment Share on other sites More sharing options...
xvweirong Posted August 6, 2012 Share Posted August 6, 2012 Where can I download JSS 1.1.2? Link to comment Share on other sites More sharing options...
Massimo Rabbi Posted August 6, 2012 Share Posted August 6, 2012 Hi,for the stand-alone version you can use the Sourceforge project page where all files are mantained:http://sourceforge.net/projects/jasperstudio/files/JaspersoftStudio-1.1.2/For the plug-in version you can use the standard update sitehttp://jasperstudio.sourceforge.net/updates/Best regards,Massimo. 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