You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by 高木敦雄 <at...@fc4.so-net.ne.jp> on 2014/03/08 09:11:24 UTC

ExcelExtractor with PHP/Java Bridge

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)

 


RE: ExcelExtractor with PHP/Java Bridge

Posted by 高木敦雄 <at...@fc4.so-net.ne.jp>.
Dear Nick;

Thank you for your reply.
I'll check the version of Apache POI on next Monday.

Atsuo Takagi
Tokyo Japan

-----Original Message-----
From: Nick Burch [mailto:apache@gagravarr.org] 
Sent: Saturday, March 8, 2014 8:33 PM
To: POI Users List
Subject: Re: ExcelExtractor with PHP/Java Bridge

On Sat, 8 Mar 2014, 高木敦雄 wrote:
> I wrote a following PHP source, however encountered an 
> IllegalArgumentException.

Your code looks fine for the latest version of Apache POI. Make sure you've
got the latest POI jars on your classpath, and that you don't accidently
have any other older ones there too

Nick


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: ExcelExtractor with PHP/Java Bridge

Posted by Nick Burch <ap...@gagravarr.org>.
On Sat, 8 Mar 2014, $B9bLZFXM:(J wrote:
> I wrote a following PHP source, however encountered an 
> IllegalArgumentException.

Your code looks fine for the latest version of Apache POI. Make sure 
you've got the latest POI jars on your classpath, and that you don't 
accidently have any other older ones there too

Nick