• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Facing issue with org.apache.poi.POIDocument: method init()V not found

 
Manish Danani
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,



I have come to the point where I just don't know what to do now. I am trying to extract text from a word document using the POI from apache. When I run the program locally there is no issue at all. However, when I try to run it on through a servlet I get the above error. All help will be highly appreciated.

Here is the stack trace of the issue:

17-08-2008 16:17:49 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet UploadFileDataServlet threw exception
java.lang.NoSuchMethodError: org.apache.poi.POIDocument: method <init>()V not found
at org.apache.poi.hwpf.HWPFDocument.<init>(HWPFDocument.java:113)
at myDataSharer.reader.MSWordParse.getDocWords(MSWordParse.java:48)
at myDataSharer.dataset.UploadFileDataServlet.doPost(UploadFileDataServlet.java:165)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
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:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
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:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)


Source code of the program running locally :

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package myDataSharer.reader;

import org.apache.poi.hwpf.extractor.*;
import org.apache.poi.POIDocument;
import java.io.*;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hwpf.*;

/**
*
* @author MDANANI
*/
public class MSWordParse {

private String fileName = "";

public MSWordParse() {
}

public static void main(String[] args){
MSWordParse wp = new MSWordParse();
System.out.println(wp.getDocWords());
}

public String getDocWords() {

String docWords = "";
this.fileName = "c:/Project1.doc";

try {

POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(fileName));


// Create a document for this file
HWPFDocument doc = new HWPFDocument(fs);
WordExtractor we = new WordExtractor(doc);
docWords = we.getText();

} catch (Exception e) {
e.printStackTrace();
return docWords;
}
return docWords;
}
}
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Offhand I'd say that the POI library on the server is a different version than the one you're compiling against.
 
Manish Danani
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply. I am using NetBeans 6.1 with Apache 6.0.16. I have included the same libraries on the project in both cases, where the program is run on its own and also from where the deployment to the server takes place.

Can you point me to the location where I should be checking for the libraries?

Thank you so much for the help!

Regards,

Manish Danani
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The crucial thing is that the libraries you're using for compilation in NetBeans are the same ones you're using at runtime in Tomcat. Comparing their byte sizes would be a good check.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic