Dear All Apache POI Users;

 

I’m a beginner of Apache POI.

 

I’m trying to extract text from excel files using PHP/Java Bridge.

I wrote a following PHP source, however encountered an
IllegalArgumentException.

 

Could anyone give me some advices?

 

Thanks!

 

Atsuo Takagi

Tokyo Japan

 

//////PHP Source/////

<?php require_once("java/Java.inc");

$file_name = "/usr/tomcat/apache-tomcat-7.0.52/webapps/JavaBridge/XXXX.xls";

$file_inst = new java('java.io.FileInputStream',$file_name);

 

$poifilesys = new
java('org.apache.poi.poifs.filesystem.POIFSFileSystem',$file_inst);

 

$excelextractor = new
java('org.apache.poi.hssf.extractor.ExcelExtractor',$poifilesys);

$excel_text = $excelextractor->getText(); echo $excel_text;

 

?>

 

////Exception/////

javax.servlet.ServletException: java.lang.RuntimeException: PHP Fatal error:
Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new
org.apache.poi.hssf.extractor.ExcelExtractor((o:POIFSFileSystem)[o:POIFSFile
System]). Cause: java.lang.IllegalArgumentException: argument type mismatch
VM: 1.7.0_51@http://java.oracle.com/
<mailto:1.7.0_51@http://java.oracle.com/> " at:

#-9 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

#-8
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
sorImpl.java:57)

#-7
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:45)

#-6 java.lang.reflect.Constructor.newInstance(Constructor.java:526)

#-5 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:487)

#-4 php.java.bridge.Request.handleRequest(Request.java:458)

#-3 php.java.bridge.Request.handleRequests(Request.java:500)

#-2 php.java.bridge.http.ContextRunner.run(ContextRunner.java:145)

#-1 php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60)

#0 /usr/tomcat/apache-tomcat-7.0.52/webapps/JavaBridge/java/Java.inc(232):
java_ThrowExceptionPr in
/usr/tomcat/apache-tomcat-7.0.52/webapps/JavaBridge/java/Java.inc on line
195

 

 
php.java.servlet.fastcgi.FastCGIServlet.handle(FastCGIServlet.java:499)

 
php.java.servlet.fastcgi.FastCGIServlet.doGet(FastCGIServlet.java:521)

        javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

        javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

        php.java.servlet.PhpCGIFilter.doFilter(PhpCGIFilter.java:126)

 

Reply via email to