I have an error while compiling report the error is:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/servlet/ServletOutputStream
this is the code:
Map parameter = new HashMap();
parameter.put("customerId", notification_table.getValueAt(r, 0).toString());
ReportV sd = new ReportV();
sd.showReport(parameter);
this is the class I used:
import java.sql.*;
import java.util.Map;
import javax.swing.*;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.swing.JRViewer;
public class ReportV {
Connection conn = null;
void showReport(Map parameters) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:pcn");
JasperReport report = JasperCompileManager.compileReport("recipt.jrxml");
JasperPrint print = JasperFillManager.fillReport(report, parameters, conn);
JRViewer viewer = new JRViewer(print);
viewer.setOpaque(true);
viewer.setVisible(true);
//make your JFrame visible
this.add(viewer);
this.setSize(300, 200);
this.setVisible(true);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
} catch (Exception ex) {
System.out.println("CAUSE: " + ex.getCause());
System.out.println("MESSAGE" + ex.getMessage());
System.out.println("LOCAL MESSAGE" + ex.getLocalizedMessage());
ex.printStackTrace();
}
}
}