2004 IR Help Posted August 23, 2006 Share Posted August 23, 2006 By: Nigel Westbury - westbury Eclipse, cannot load JRFillParameter 2005-08-05 12:30 I have a problem that is proving most intractable. I have a straight-forward Eclipse plug-in that displays JasperReports. The report is filled using JRBeanCollectionDatasource. However, the call to JasperFillManager.fillReport fails: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/fill/JRFillParameter at PhysicalServers.initParams(PhysicalServers.java:82) at PhysicalServers.customizedInit(PhysicalServers.java:71) at net.sf.jasperreports.engine.fill.JRCalculator.init(JRCalculator.java:99) at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:594) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:83) at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:75) at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:113) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:428) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:409) ..... Obviously the jar is in the class load path (jasperreports-1.0.0.jar) as all the other classes were found. Somehow it seems the class load path is being altered when the compiled class (in this case, PhysicalServers) is called. I have tried changing the compiler class used to compile the report (trying JRJdk12Compiler and JRJavacCompiler). I have tried, amongst other things, building the application with 1.2 and 1.4 compliant class files (I have JDK 1.5/5.0 installed). Whatever I try, I get the same error. What mystifies me is that JasperReports within an Eclipse plug-in is common yet I can find no one else with a similar problem. I have used JasperReports myself in an Eclipse plug-in without problem. If no one else comes up with any ideas then I will try next to extract the source for the class compiled into the jasper file and include that source file directly into my project. This will involve some changes to the jasperreport source but may ultimately be the quickest way of bypassing this problem. It occured to me that as the compiled class design causes a lot of problems, it would be useful if JasperReports supported an alternative process in which the compiler outputs a java source file (not the class file as a jasper file) which can be added simply into the project. While not allowing dynamic loading of reports, this would be a lot more reliable. If I did this, would the changes be of interest to the committers for inclusion in JasperReports? Nigel By: Teodor Danciu - teodord RE: Eclipse, cannot load JRFillParameter 2005-08-05 23:15 Hi, Have you tried to use the BeanShell-based compilers that now we ship as a sample inside /demo/samples/beanshell ? I hope this helps. Teodor By: Nigel Westbury - westbury RE: Eclipse, cannot load JRFillParameter 2005-08-06 11:46 Teodor, You are correct in predicting that use of the compiler in BeanShell would fix my problem. It did, thanks. This still leaves the problem for users who build using the command line method (ant.JRAntCompileTask.main). What is the story on this and the BeanShell method? Is the ant package now obsolete? The documentation makes no mention of the BeanShell method. It was a long and very tortuous route from the JRFillParameter class not found error to updating to the new and undocumented build process, and I would hate to think that any more people than necessary are hit by this. I realize you must be very busy, so if you need any help I would be happy to send you some updated web pages. Alternatively if you are still supporting JRAntCompileTask then let me know if you would like me to do any further investigation to fix the problem. Nigel By: Teodor Danciu - teodord RE: Eclipse, cannot load JRFillParameter 2005-08-06 23:39 Hi, What is the exception you get when compiling reports with the BeanShell compiler using the ANT task? Do you get the same exception when launching "ant compile" in the "beanshell" sample provided? Thank you, Teodor By: Nigel Westbury - westbury RE: Eclipse, cannot load JRFillParameter 2005-08-13 21:44 I am sorry to be a while before getting back to you. There is not a problem with ant itself. The problem there is purely one of documentation, as no reference to the BashCompiler is made in the documentation for the ant build. Sorry for the confusion there. The originating error in the run time is as follows: Caused by: Sourced file: inline evaluation of: ``bshCalculator = createBshCalculator();'' : Typed variable declaration : Class: JRCalculator not found in namespace : at Line: 19 : in file: eval stream : JRCalculator Called from method: createBshCalculator : at Line: 1 : in file: inline evaluation of: ``bshCalculator = createBshCalculator();'' : createBshCalculator ( ) This seems to be essentially the same problem as before. JRCalculator is in jasperreports-1.0.0.jar. Although this jar is in both the build path and the class path, it appears that the path is not being used by the JRBshCalculator class when calling the interpreter. The failing line is: interpreter.eval("bshCalculator = createBshCalculator()"); in the customizedInit method. Nigel 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