onsir 0 Light Poster

I have design report with ireport, if that report i run in netbeans its ok,
but while i move to drive c: got error like this

"error displaying report page. see the console for details"

if i try in command prompt get message

java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(J
RClassLoader.java:161)
at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRCla
ssLoader.java:119)
at net.sf.jasperreports.engine.export.ExporterFilterFactoryUtil.getFilte
rFactory(ExporterFilterFactoryUtil.java:56)
at net.sf.jasperreports.engine.JRAbstractExporter.createFilter(JRAbstrac
tExporter.java:1071)
at net.sf.jasperreports.engine.export.JRGraphics2DExporter.exportReport(
JRGraphics2DExporter.java:121)
at net.sf.jasperreports.view.JRViewer.paintPage(JRViewer.java:1993)
at net.sf.jasperreports.view.JRViewer$PageRenderer.paintComponent(JRView
er.java:2134)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JViewport.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknow
n Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
2009-05-19 15:48:03,359 [AWT-EventQueue-0] INFO org.hibernate.impl.SessionFacto
ryImpl closing
2009-05-19 15:48:03,359 [AWT-EventQueue-0] INFO org.hibernate.connection.Driver
ManagerConnectionProvider cleaning up connection pool: jdbc:mysql://localhost/a1
2s

this my code

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import mst.common.CommonUtility;
import mst.hrd.hibernate.properties.HibernateConnection;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.query.JRHibernateQueryExecuterFactory;
import net.sf.jasperreports.view.*;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
*
* @author user
*/
public class RptVacancy extends javax.swing.JPanel {

private static final String TASK_VIEW = "view";
private String taskName = "view";
private final String stdReportFileName = new String(CommonUtility.setPathReport() + "listApplicant.jasper");
private String reportFileName;
private Transaction tx;

/** Creates new form HRptVacancy */
public RptVacancy() {
initComponents();
}


// Hibernate Result Set Holder.
List bowlerInfo = null;

public void typeReport() {
try {
if (TASK_VIEW.equals(taskName)) {
startOperation();
Query query = HibernateConnection.session.createQuery("from Vacancy");
bowlerInfo = query.list();

// Fill the parameters
HashMap parameters = new HashMap();
parameters.put("titleReport", "List");

JasperPrint print = JasperFillManager.fillReport(reportFileName, parameters, new JRBeanCollectionDataSource(bowlerInfo));
JasperViewer.viewReport(print, false);

// Close the Hibernate Session.
HibernateConnection.closeSession();
}

} catch (Exception e) {
e.printStackTrace();
}
}


protected void startOperation() throws HibernateException {
HibernateConnection.getOpenSession();
tx = HibernateConnection.session.beginTransaction();
}


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
reportFileName=stdReportFileName;
typeReport();
}

thanks

Dani AI

Generated

— when a report runs fine inside NetBeans but throws a viewer error after you move the program, the cause is almost always a runtime classpath difference (missing jars or resources) rather than a bug in the report itself. The JasperReports viewer creates exporter/filter classes at paint time, so if any exporter-related class, Hibernate helper, or a custom scriptlet referenced by the compiled .jasper is not on the external classpath, the viewer can fail with class-loading NPEs.

Check these items in order:

  • Confirm the external run uses the same set of libraries NetBeans supplies. NetBeans puts dependencies under dist/lib or supplies them on its runtime classpath; your standalone run must include the same jars (jasperreports.jar, jasperreports-hibernate or any adapter you used, hibernate core jars, commons-logging/collections/digester, iText/JFreeChart/Batik/POI if the report needs them, plus any custom jars).
  • Inspect the .jasper in iReport for custom classes, scriptlets, fonts, or exporters and make sure those jars are present when running from C:.
  • If you built a runnable JAR, verify its manifest Class-Path references the dist/lib files, or run with an explicit classpath.

Quick diagnostic steps:

  • Run the app with verbose class loading to see what fails to load:
    java -verbose:class -cp "YourApp.jar;lib/*" com.your.MainClass
  • Try exporting the JasperPrint to a file (to isolate the viewer):
    JasperExportManager.exportReportToPdfFile(jasperPrint, "test.pdf");

    If PDF export works but the viewer fails, the problem is viewer/exporter-specific and probably a missing exporter/filter or graphics library.

Packaging tips:

  • Use NetBeans’ dist folder as-is when moving the app, or build a proper "fat" jar that includes all dependencies. Watch for duplicate/conflicting versions of commons-logging or other common libs. If everything matches and the problem persists, try updating to a newer JasperReports jar (some older releases had classloader/exporter fixes).

For reference on required runtime modules and packaging guidance see the JasperReports Library project page: JasperReports Library project page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.