• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error while running in ecllipse.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam getting this type of error when i run the froll code in ecllipse.But this is not happening in case netbeans.Also i included the jar files.

import java.io.*;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperRunManager;
import java.sql.*;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.JasperReport;
import java.util.HashMap;

public class as
{
public static void main(String[] args)
{

try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c= DriverManager.getConnection("jdbc dbc:access1","","");
System.out.println("starting");
JasperCompileManager.compileReportToFile("D:\\ALL IBM PROJECTS\\projects\\test\\WebContent\\WEB-INF\\test.jrxml");
//JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null,c);

JasperFillManager.fillReportToFile("D:\\ALL IBM PROJECTS\\projects\\test\\WebContent\\WEB-INF\\test.jasper",new HashMap(),c);
JasperViewer.viewReport(jasperPrint);
System.out.print("starting and now ending");
}
catch (Exception e)
{
String connectMsg = "Could not create the report "+ e.getMessage() + " " + e.getLocalizedMessage();
System.out.println(connectMsg);
}

}
}
And the error

Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/util/PublicCloneable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.visitChart(JRFillObjectFactory.java:719)
at net.sf.jasperreports.engine.base.JRBaseChart.visit(JRBaseChart.java:610)
at net.sf.jasperreports.engine.JRAbstractObjectFactory.getVisitResult(JRAbstractObjectFactory.java:91)
at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:86)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:91)
at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:87)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:522)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:528)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:188)
at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:94)
at a.as.main(as.java:47)

Can anyone help me out..I am in great need of it.
 
Potter James
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry change the code to the foll one

import java.io.*;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperRunManager;
import java.sql.*;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.JasperReport;
import java.util.HashMap;

public class as
{
public static void main(String[] args)
{
try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c= DriverManager.getConnection("jdbc dbc:access1","","");
System.out.println("starting");
JasperDesign jasperDesign = JRXmlLoader.load(new File("D:\\ALL IBM PROJECTS\\projects\\test\\WebContent\\WEB-INF\\test.jrxml"));
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null,c);
JasperViewer.viewReport(jasperPrint);
System.out.print("starting and now ending");
}
catch (Exception e)
{
String connectMsg = "Could not create the report "+ e.getMessage() + " " + e.getLocalizedMessage();
System.out.println(connectMsg);
}
}
}
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi James,

The clue here is that it can't find the org/jfree/util/PublicCloneable on your CLASSPATH in eclipse.

Now I think you stated that this is occurring at runtime so you'll need to edit the run configuration in eclipse (under the run menu)
 
Potter James
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you tell what the changes must i do.Also say me where it must be done in run...
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I'll try to be a little more specific .

1.) You are missing the JAR file from your CLASSPATH which holds the org.jfree.util.PublicCloneable class, you'll need to find out what that jar file is.

2.) If you click on the "Run" menu in Eclipse you'll see a menu option there called "Run Configurations". In there you'll be able to add the location of the JAR file to your CLASSPATH for the code you are trying to run.
 
Potter James
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Martijn ,I finally came out of that error.I added a jar file called JCommon.jar to solve it .But now i landed in an another error

Exception in thread "main" java.lang.NoSuchMethodError: org.jfree.ui.RectangleInsets.<init>(DDDD)V
at org.jfree.chart.plot.Plot.<clinit>(Plot.java:192)
at org.jfree.chart.ChartFactory.createPieChart3D(ChartFactory.java:690)
at net.sf.jasperreports.engine.fill.JRFillChart.evaluatePie3DChart(JRFillChart.java:2097)
at net.sf.jasperreports.engine.fill.JRFillChart.evaluateChart(JRFillChart.java:1316)
at net.sf.jasperreports.engine.fill.JRFillChart.evaluateRenderer(JRFillChart.java:1237)
at net.sf.jasperreports.engine.fill.JRFillChart.resolveElement(JRFillChart.java:2998)
at net.sf.jasperreports.engine.fill.JRFillElement.resolveElement(JRFillElement.java:895)
at net.sf.jasperreports.engine.fill.JRBaseFiller.resolveBoundElements(JRBaseFiller.java:1396)
at net.sf.jasperreports.engine.fill.JRBaseFiller.resolveBoundElements(JRBaseFiller.java:1421)
at net.sf.jasperreports.engine.fill.JRBaseFiller.resolveReportBoundElements(JRBaseFiller.java:1431)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummary(JRVerticalFiller.java:907)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportEnd(JRVerticalFiller.java:286)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:120)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:889)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:792)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
at a.as.main(as.java:28)
When i searched in I came to know that this can be solved by adding jcommon.jar..But also this error is not going..
Is anyone having experience in solving this kind of situation.

[ September 15, 2008: Message edited by: Potter James ]
[ September 15, 2008: Message edited by: Potter James ]
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi James,

Good to see progress! If you look at the error it's telling you that it cannot find that method. That means you are using a version of the class/jar that is not compatible with what you are trying to do. You'll need to use the Jar that contains the 'correct' version.
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congratulations on the "Rancher" handle, Martijn.
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Campbell Ritchie:
Congratulations on the "Rancher" handle, Martijn.



Thanks Campbell, I've found this place to be a great community for guiding me to answers (and not to mention proving me wrong on more than one occasion!), glad I can help out in return
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Martijn Verburg:
Thanks Campbell, I've found this place to be a great community for guiding me to answers (and not to mention proving me wrong on more than one occasion!), glad I can help out in return



Me too
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic