You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2009/04/22 16:18:15 UTC
DO NOT REPLY [Bug 47074] New: java.lang.NoSuchMethodError:
org.apache.poi.POIDocument.(
https://issues.apache.org/bugzilla/show_bug.cgi?id=47074
Summary: java.lang.NoSuchMethodError:
org.apache.poi.POIDocument.<init>(
Product: POI
Version: unspecified
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: POIFS
AssignedTo: dev@poi.apache.org
ReportedBy: kishore.kandrup@nomura.com
Hi Iam trying to read excel file as per the program (downloaded from internet,
attached for reference here) But i am getting below error:
got 'SummaryInformation' event for path '\'.
got 'DocumentSummaryInformation' event for path '\'.
got 'Workbook' event for path '\'.
trying DirectoryNode 'Root Entry'
Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.poi.POIDocument.<init>(Lorg/apache/poi/poifs/filesystem/DirectoryNode;Lorg/apache/poi/poifs/filesystem/POIFSFileSystem;)V
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:225)
at
com.lehman.pcs.bcu.util.POIFSExtract$MyPOIFSReaderListener.processPOIFSReaderEvent(POIFSExtract.java:53)
at
org.apache.poi.poifs.eventfilesystem.POIFSReader.processProperties(POIFSReader.java:261)
at
org.apache.poi.poifs.eventfilesystem.POIFSReader.read(POIFSReader.java:97)
at com.lehman.pcs.bcu.util.POIFSExtract.main(POIFSExtract.java:29)
I am using jars of version as below :
poi-3.1-FINAL.jar
poi-scratchpad-3.0.1-FINAL.jar
poi-contrib-3.1-FINAL.jar
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 47074] java.lang.NoSuchMethodError:
org.apache.poi.POIDocument.(
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47074
--- Comment #1 from Kishore <ki...@nomura.com> 2009-04-22 07:19:27 PST ---
The attached code is pasted below.
package com.lehman.pcs.bcu.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import org.apache.poi.hssf.record.RecordFormatException;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.eventfilesystem.POIFSReader;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.POIFSDocumentPath;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class POIFSExtract {
public static void main(String[] args) throws Exception {
//if (args == null || args.length < 1)
//throw new Exception("\n->no input, no output<-");
String fileName1 =
"H:\\Kishor\\Research\\EmailWorkFlow\\Web_Server_Comparison.xls";
POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream(fileName1));
POIFSReader reader = new POIFSReader();
reader.registerListener(new MyPOIFSReaderListener(fs));
reader.read(new FileInputStream(fileName1));
}
static class MyPOIFSReaderListener implements POIFSReaderListener {
private POIFSFileSystem fs;
public MyPOIFSReaderListener(POIFSFileSystem fs) {
this.fs = fs;
}
public void processPOIFSReaderEvent(POIFSReaderEvent event) {
String name = event.getName();
POIFSDocumentPath path = event.getPath();
System.out.println("got '" + name + "' event for path '" + path
+ "'.");
if (name.endsWith("Workbook") || name.endsWith("WORKBOOK")) {
try {
DirectoryNode dir = resolveDir(fs,
event.getPath().toString()); // converting it to
DirectoryNode
System.out.println(" trying DirectoryNode '" +
dir.getName() + "'");
HSSFWorkbook wb = new HSSFWorkbook(dir, fs, true);
//invoke HSSFWorkbook constructor passing this directory to
it
System.out.println(" !!! success: workbook with " +
wb.getNumberOfSheets() + " sheets.");
}
catch (RecordFormatException e) {
// MS Graph charts are stored in "Workbook" stream too
System.out.println(" skipping embedded MS Graph object!");
}
catch (Exception e) {
System.out.println(" " + e.getMessage());
throw new RuntimeException(e.getMessage());
}
}
}
static DirectoryNode resolveDir(POIFSFileSystem filesystem,
String path) throws FileNotFoundException {
DirectoryNode dir = filesystem.getRoot();
for (String token : path.split("\\" + File.separator)) {
if (!token.equals("") && !token.equals(File.separator))
dir = (DirectoryNode) dir.getEntry(token);
}
return dir;
}
}
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 47074] java.lang.NoSuchMethodError:
org.apache.poi.POIDocument.(
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47074
Nick Burch <ni...@torchbox.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #2 from Nick Burch <ni...@torchbox.com> 2009-04-22 07:26:57 PST ---
You almost certainly have a different version of poi on your run classpath to
your compile classpath. Please see the faq on the site for how to test which
jars you're really running with.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org