title: How to avoid getting java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
body: <p>I have a <em>NetBeans</em> project in which I want to design jasper report, when I fill report via <em><code>JasperFillManager.fillReport</code></em> then I found an error message. </p>
  
  <p>How can I resolve this?</p>
  
  <p>I've used <em>iReport 5.0.0</em> and <em>JasperReports library 5.1.0</em>.</p>
  
  <p>my code is described below</p>
  
  <pre><code>try {
      String reportName = "./rptJobList.jasper";
      InputStream is = new FileInputStream(reportName);
      Class.forName("com.mysql.jdbc.Driver");
      Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/js001?user=root&amp;password=admin");
      JasperPrint jasperPrint = JasperFillManager.fillReport(is, null, con);
      JasperViewer jv = new JasperViewer(jasperPrint);
      jv.setVisible(true);
  } catch (Exception ex) {
  }
  </code></pre>
  
  <p>The exception is:</p>
  
  <blockquote>
    <p>Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
    org/apache/commons/logging/LogFactory     at
    net.sf.jasperreports.engine.util.JRLoader.(JRLoader.java:68)
      at
    net.sf.jasperreports.engine.JRPropertiesUtil.loadProperties(JRPropertiesUtil.java:99)
      at
    net.sf.jasperreports.engine.DefaultJasperReportsContext.initProperties(DefaultJasperReportsContext.java:94)
      at
    net.sf.jasperreports.engine.DefaultJasperReportsContext.(DefaultJasperReportsContext.java:71)
      at
    net.sf.jasperreports.engine.DefaultJasperReportsContext.(DefaultJasperReportsContext.java:59)
      at
    net.sf.jasperreports.engine.JasperFillManager.getDefaultInstance(JasperFillManager.java:85)
      at
    net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:824)
      at job.NewClass.jButton2ActionPerformed(NewClass.java:64)   at
    job.NewClass.access$000(NewClass.java:21)     at
    job.NewClass$1.actionPerformed(NewClass.java:42)  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:6134)    at
    javax.swing.JComponent.processMouseEvent(JComponent.java:3265)    at
    java.awt.Component.processEvent(Component.java:5899)  at
    java.awt.Container.processEvent(Container.java:2023)  at
    java.awt.Component.dispatchEventImpl(Component.java:4501)     at
    java.awt.Container.dispatchEventImpl(Container.java:2081)     at
    java.awt.Component.dispatchEvent(Component.java:4331)     at
    java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
      at
    java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
      at java.awt.Container.dispatchEventImpl(Container.java:2067)    at
    java.awt.Window.dispatchEventImpl(Window.java:2458)   at
    java.awt.Component.dispatchEvent(Component.java:4331)     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.apache.commons.logging.LogFactory     at
    java.net.URLClassLoader$1.run(URLClassLoader.java:200)    at
    java.security.AccessController.doPrivileged(Native Method)    at
    java.net.URLClassLoader.findClass(URLClassLoader.java:188)    at
    java.lang.ClassLoader.loadClass(ClassLoader.java:307)     at
    sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)     at
    java.lang.ClassLoader.loadClass(ClassLoader.java:252)     at
    java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)     ... 35
    more</p>
  </blockquote>