Hi fellows! I'm in a bit of a pickle with using our dear POI, for I'm having this dastard error and I really can't identify why it's happening.
Would you guys mind helping me?
My SO is win7(x64) and I have the following libs included on my Eclipse IDE:
poi-3.9-20121203.jar
poi-ooxml-3.9-20121203.jar
poi-ooxml-schemas-3.9-20121203.jar
ooxml-lib\dom4j-1.6.1.jar
xmlbeans-2.3.0.jar
To which, as far as I'm aware, should be more than enough to run the following class:
The following error :
is thrown when running the line 18 or, in the current case, the declaration of doc (XWPFDocument doc = ...).
I really am totally lost here guys, please help this lad here: why is the error being thrown? How do I fix it?
Would you guys mind helping me?
My SO is win7(x64) and I have the following libs included on my Eclipse IDE:
poi-3.9-20121203.jar
poi-ooxml-3.9-20121203.jar
poi-ooxml-schemas-3.9-20121203.jar
ooxml-lib\dom4j-1.6.1.jar
xmlbeans-2.3.0.jar
To which, as far as I'm aware, should be more than enough to run the following class:
Code:
public class Extracao
{
public void extrai(List<Noticia> passagem, String chave) throws FileNotFoundException, IOException
{
XWPFDocument doc = new XWPFDocument();
XWPFParagraph paragrafo = doc.createParagraph();
XWPFRun aplicacao = paragrafo.createRun();
Noticia temporario;
System.out.println("Ponto!" + passagem.size());
while(!passagem.isEmpty())
{
temporario = passagem.remove(0);
aplicacao.setText("Data : " + temporario.getData());
aplicacao.addBreak();
aplicacao = paragrafo.createRun();
aplicacao.setText("Classe : " + temporario.getClasse() + " Setor : " + temporario.getSetor());
aplicacao.addBreak();
aplicacao = paragrafo.createRun();
aplicacao.setText("Tipo : " + temporario.tipoTexto() + " Estado : " + temporario.getEstado());
aplicacao.addBreak();
aplicacao = paragrafo.createRun();
divideTexto(doc,paragrafo, aplicacao, temporario.getNoticia());
aplicacao.addBreak();
aplicacao.addBreak();
aplicacao.addBreak();
}
doc.write(new FileOutputStream(new File(chave + "\"" + "arquivoDeSaida.docx")));
}
private void divideTexto(XWPFDocument documento, XWPFParagraph paragrafo, XWPFRun app, String alvo)
{
if(alvo.length() > 50)
{
int j, limite = 0;
for(j = 0; j <= alvo.length(); j += 50)
{
app.setText(alvo.substring(j, j + 50));
app.addBreak();
app = paragrafo.createRun();
limite = j;
}
if(limite != alvo.length())
{
app.setText(alvo.substring(j - 50, alvo.length()));
app.addBreak();
}
}
else app.setText(alvo);
app.addBreak();
}
}Code:
WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: org/apache/poi/xwpf/usermodel/XWPFDocument
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)I really am totally lost here guys, please help this lad here: why is the error being thrown? How do I fix it?