title: Export the data into a PDF format with Tomahawk?
body: <p>In my application I am trying to export the data from the <code>&lt;h:DataTable&gt;</code> into a PDF file using Apache TomaHawk. While loading the page I am getting an exception. I have Pasted my code and the exception below.</p>
  
  <p><strong>JSF Code</strong></p>
  
  <pre><code>&lt;%@ page session="false" contentType="text/html;charset=utf-8"%&gt; 
  &lt;%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%&gt; 
  &lt;%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%&gt;
  &lt;%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%&gt;
  &lt;%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%&gt;
  &lt;f:view&gt;
  &lt;html&gt;
      &lt;body&gt;
          &lt;h:form&gt;
              &lt;p&gt;
                  This component allows to export the datatable contents to an excel
                  or pdf file.
              &lt;/p&gt;
  
              &lt;br&gt;
              &lt;t:dataTable id="tbl_cars" var="car" value="#{exBean.list}"
                  preserveDataModel="false"&gt;
                  &lt;t:column&gt;
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="Id" /&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="#{car.id}" /&gt;
                  &lt;/t:column&gt;
  
                  &lt;t:column&gt;
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="Type" /&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="#{car.type}" /&gt;
                  &lt;/t:column&gt;
  
                  &lt;t:column&gt;
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="Color" /&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="#{car.color}" /&gt;
                  &lt;/t:column&gt;
  
              &lt;/t:dataTable&gt;
              &lt;h:commandButton action="" value="Export as excel"&gt;
                  &lt;s:exporterActionListener for="tbl_cars" fileType="XLS" /&gt;
              &lt;/h:commandButton&gt;
  
              &lt;br&gt;
  
              &lt;h:commandButton action="" value="Export as pdf"&gt;
                  &lt;s:exporterActionListener for="tbl_cars" fileType="PDF" /&gt;
              &lt;/h:commandButton&gt;
  
  
          &lt;/h:form&gt;
  
      &lt;/body&gt;
  
  &lt;/html&gt; 
      &lt;/f:view&gt;
  </code></pre>
  
  <p><strong>Exception</strong></p>
  
  <pre><code>java.lang.NoClassDefFoundError: Could not initialize class    org.apache.myfaces.shared_tomahawk.config.MyfacesConfig
  at org.apache.myfaces.renderkit.html.util.ExtensionsPhaseListener.writeCodeBeforeBodyEnd(ExtensionsPhaseListener.java:130)
  at org.apache.myfaces.renderkit.html.util.ExtensionsPhaseListener.getCodeBeforeBodyEnd(ExtensionsPhaseListener.java:104)
  at org.apache.myfaces.renderkit.html.util.ExtensionsPhaseListener.getJavaScriptCodeAndStoreInRequest(ExtensionsPhaseListener.java:94)
  at org.apache.myfaces.renderkit.html.util.ExtensionsPhaseListener.afterPhase(ExtensionsPhaseListener.java:70)
  at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:92)
  at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:142)
  at org.apache.myfaces.custom.ppr.PPRLifecycleWrapper.render(PPRLifecycleWrapper.java:84)
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
  at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
  at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
  at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
  at java.lang.Thread.run(Thread.java:619)
  </code></pre>