title: Primefaces generating java.lang.NoClassDefFoundError: com/lowagie/text/Document on call method to generate PDF for fileDownload
body: <p>I need your help in solving the issue of not finding the class com/lowagie/text/Document in iText jar. The Primefaces version is 5.0 and the iText version is 2.1.7. The error is generated when I am adding the method name in the actionListner for calling it in order to generate a PDF file from a method and to make it downloadable on the click of a commandButton.</p>
  
  <p>I trued removing all the JARs and adding them one by one and still the issue is the same. All the JARs are unique and I am using Jdeveloper.</p>
  
  <p>The Bean code is:</p>
  
  <pre><code>public void createPdf1() {
      com.lowagie.text.Document doc = new com.lowagie.text.Document(PageSize.A4, 50, 50, 50, 50);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      ByteArrayInputStream in ;
      try {
  
          PdfWriter writer;
  
          writer = PdfWriter.getInstance(doc, out);
  
          doc.open();
          PdfPTable table = new PdfPTable(1);
          PdfPCell cell = new PdfPCell(new Phrase("First PDF"));
          cell.setBorder(Rectangle.NO_BORDER);
          cell.setRunDirection(PdfWriter.RUN_DIRECTION_LTR);
          table.addCell(cell);
          doc.add(table);
          in = new ByteArrayInputStream(out.toByteArray());
          file = new DefaultStreamedContent(in, "application/pdf", "xxx.pdf");
          System.out.println("INSIDE");
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>And the jsf code is which I followed the showcase:</p>
  
  <p>
      
  </p>
  
  <pre><code>&lt;p:commandButton value="Download" ajax="false" onclick="PrimeFaces.monitorDownload(start, stop);" icon="ui-icon-arrowthick-1-s" actionListner="#{pdf.createPdf1}"&gt;
      &lt;p:fileDownload value="#{pdf.file}" /&gt;
  &lt;/p:commandButton&gt;
  </code></pre>
  
  <p>On the click of the commandButton, I am getting the error:</p>
  
  <blockquote>
    <p>javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError:
    com/lowagie/text/Document     at
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
      at
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      at javax.faces.component.UICommand.broadcast(UICommand.java:315)    at
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
      at
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
      at
    oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:973)
      at
    oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:354)
      at
    oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
    Caused By: java.lang.ClassNotFoundException: com.lowagie.text.Document
      at
    weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
      at
    weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
      at
    weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:305)    at
    java.lang.ClassLoader.loadClass(ClassLoader.java:246)     at
    weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
      at
    weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)</p>
  </blockquote>