wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes problems in viewing jasper reports Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "problems in viewing jasper reports" Watch "problems in viewing jasper reports" New topic
Author

problems in viewing jasper reports

pratik doshi
Greenhorn

Joined: Jul 22, 2010
Posts: 6
package connection;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import net.sf.jasperreports.view.*;
import net.sf.jasperreports.engine.*;
import java.sql.*;
import java.util.*;
public class testparameter extends JFrame implements ActionListener {

public testparameter() {
initcomponent();
design();
}
JasperPrint JPrint;
JButton btnShowReport;
JLabel lblParameter;
JLabel lblParameter1;
JTextField txtParameter;
JTextField txtParameter1;

public static void main(String args[]) {


new testparameter();
}

public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnShowReport) {
showReport();
}

}

private void initcomponent() {
btnShowReport = new JButton("SHOW REPORT");
btnShowReport.setMnemonic('S');
btnShowReport.addActionListener(this);

lblParameter = new JLabel("Start Date");
lblParameter1 = new JLabel("End Date");

txtParameter = new JTextField(15);
txtParameter1 = new JTextField(15);
}

public void showReport() {
try {

// PREPARING DATABASE CONNECTION
String jdbcDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
Class.forName(jdbcDriver);
String url = "jdbc:sqlserver://localhost;databaseName=CFC1";

String user = "sa";
String pass = "sapassword";

Connection con = DriverManager.getConnection(url, user, pass);

// PATH TO YOUR JASPER FILE
String fullPath = "C:\\Users\\vaggarwal\\Desktop\\Jasper Reports\\sqljdbc_1.2.2828.100_enu\\sqljdbc_1.2\\enu\\betdates.jasper";

// PREPARE THE PARAMETERS
Map<String, Object> param = new HashMap<String, Object>();
param.put("startdate", txtParameter.getText());
param.put("enddate", txtParameter1.getText());
// FILL THE REPORT
JPrint = JasperFillManager.fillReport(fullPath, param, con);

// VIEW THE REPORT
JasperViewer.viewReport(JPrint, false);
// CLOSE CONNECTION
con.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}

private void design() {
setTitle("Test Parameter");
getContentPane().setLayout(new FlowLayout());
getContentPane().add(lblParameter);
getContentPane().add(txtParameter);
getContentPane().add(lblParameter1);
getContentPane().add(txtParameter1);
getContentPane().add(btnShowReport);
pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
show();
}
}
==================================================================================



Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:472)
at net.sf.jasperreports.engine.JasperCompileManager.loadEvaluator(JasperCompileManager.java:238)
at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:421)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:428)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:76)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:86)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:56)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:142)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:52)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)
at connection.testparameter.showReport(testparameter.java:70)
at connection.testparameter.actionPerformed(testparameter.java:32)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.control.CompilationFailedException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 43 more
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Welcome to JavaRanch!

Please UseCodeTags when posting code. Looks like you're missing a library, or using the wrong version, perhaps?
pratik doshi
Greenhorn

Joined: Jul 22, 2010
Posts: 6
David Newton wrote:Welcome to JavaRanch!

Please UseCodeTags when posting code. Looks like you're missing a library, or using the wrong version, perhaps?


please help me out with this
pratik doshi
Greenhorn

Joined: Jul 22, 2010
Posts: 6
pratik doshi wrote:
David Newton wrote:Welcome to JavaRanch!

Please UseCodeTags when posting code. Looks like you're missing a library, or using the wrong version, perhaps?


please help me out with this


what do you mean by wrong version
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I just did, but in case your access to search engines is restricted:

http://grails-groovy.blogspot.com/2009/08/groovy-compilation-problem-while.html

When I searched on the exception class I got the API docs, and a bunch of links relating to the same issue with JR.

Moving to more appropriate forum
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problems in viewing jasper reports
 
Similar Threads
jasper error in linux
java.lang.NoClassDefFoundError: while running jasper report from servlet
error while invoking jasper from servlet using applet
Jasper Exception
Jasper Report Error