Closed (fixed)
Project:
Sheetnode
Version:
6.x-1.5-beta3
Component:
XLS integration
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 Oct 2009 at 12:07 UTC
Updated:
22 Nov 2010 at 10:23 UTC
Jump to comment: Most recent file
Comments
Comment #1
infojunkiePlease go to the status report page (admin/reports/status). What are the values for "Apache POI", "PHP/Java Bridge extension", "PHP/Java Bridge include files" ?
In case the PHP/Java Bridge entries are fine but Apache POI isn't, please make sure the Sheetnode XLS settings (admin/settings/xls) is configured to point to a folder where you extracted the Apache POI 3.5-FINAL package. check the status report page again.
Comment #2
spivey commentedAll this checks out -
Apache POI - is found.
PHP/Java Bridge Extension - is loaded in php.ini
PHP/Java Bridge Include Files - are found.
I tried moving the POI folders from a folder on /usr to the sites/defaults/files directory in case there was a file permission error, but that didn't help. I've also tried POI- 3.5 Beta6 to see if the 3.5 Final had an issue, but that wasn't it (I couldn't find 3.4 Beta).
The PHP/Java Bridge files a sym'd to my tomcat folder, but that shouldn't matter, should it?
Comment #3
infojunkie> The PHP/Java Bridge files a sym'd to my tomcat folder, but that shouldn't matter, should it?
Not that I know of, and besides the fact that the status report shows the POI version number (it does show it, doesn't it?) means that the module is able to call the POI jar file and get a reply.
What are you PHP/Java Extension settings (in php.ini)? Mine are:
extension = java.so
java.log_level = 3
java.log_file = /var/log/php-java-bridge.log
java.security_policy = Off
Please examine the error log above to see if anything's reported.
Comment #4
spivey commentedFrom php.ini:
[java]
java.java_home = "/usr/lib/java/bin"
java.java = "/usr/lib/java/jre"
java.class.path = "/usr/local/tomcat6/webapps/JavaBridge/WEB-INF/lib/JavaBridge.jar"
java.library = "/usr/local/javabridge/ext/java"
java.library.path = "/usr/local/javabridge/ext"
java.log_file = "/var/log/php-java-bridge.log"
java.log_level = 3
java.security_policy = Off
I didn't have a log file specified or the security policy declared, so I added both. After restarting Apache and Tomcat I still get the same error when trying to export a XLS, and nothing is recorded in the logfile. Does this sound like the request isn't making it to java?
Comment #5
spivey commentedYes, the POI version is shown on the status report page.
Comment #6
infojunkieDebugging PHP/Java Bridge issues can be a pain. Thanks for your patience.
Please try the following code, outside of Drupal: http://php-java-bridge.sourceforge.net/pjb/examples/source.php?source=ex.... You will need to make POI available in some shared JAR folder on Tomcat. Does this code generate a file?
When this code works, please replace the line in sheetnode_xls.export.inc
with
Does this line still give you an error?
Comment #7
spivey commentedThe sample in Tomcat worked, I downloaded an excel file that looks exactly like the one on the JavaBridge examples page - is this correct?
When replace the code in sheetnode_xls.export.inc, I no longer get the error but nothing downloads - it's just a blank page - the URL is the node path assigned to the feed.
Comment #8
spivey commentedJust to make sure all the basis were covered, I cleared Drupal's cache, View's cache, my browsers cache, and restarted Tomcat and Apache. Now when I try sheetnode I get:
Fatal error: Class 'org_apache_poi_ss_usermodel_Cell' not found in /var/www/aqcomm/addmods/sheetnode/sheetnode_xls.export.inc on line 97
Comment #9
infojunkie> The sample in Tomcat worked, I downloaded an excel file that looks exactly like the one on the JavaBridge examples page - is this correct?
Yes I wanted to make sure that the standard examples do work.
> When replace the code in sheetnode_xls.export.inc, I no longer get the error but nothing downloads - it's just a blank page - the URL is the node path assigned to the feed.
That's expected. I was trying to confirm the source of the problem, but it's not solved yet.
The PHP class "org_apache_poi_hssf_usermodel_HSSFWorkbook" is supposed to be auto-created by the bridge along with all other classes contained in the jars specified in java_autoload() - used in sheetnode_xls.export.inc line 7. That's the class that's not found, whereas the Java class itself, when accessed via java("org.apache.poi.hssf.usermodel.HSSFWorkbook"), is found.
To determine whether this is a missing setting in the Sheetnode module or something global to your PHP/Java Bridge installation, please try the following code, outside of Drupal:
The only changes are the
java_autoload()call and different class names. Are you able to run this?Comment #10
spivey commentedThis gives me a HTTP 500 error:
Something's wrong with Java?
Comment #11
infojunkieSorry, I should have been more explicit: the string
"<full path of each jar in POI folders separated by semicolon>"in the code snippet needs to be replaced with something like:which is the full path of *each* jar file inside the POI folder. Just replace the path here with your own.
Comment #12
spivey commentedI'm going to try this, but I've ran into other issues (not with this) that need to be addressed. I'll get an update to you as soon as I can.
Comment #13
spivey commentedOk I'm back. Long story short I had something else to take care on this box, but now that's fixed.
Since my last post I went back and was re-reading some docs. I realized I was running Tomcat6 and decided to try 5.5,
Now that is running, but the PHP/Java Bridge module isn't finding Java.inc. I've tried links and directories in the Drupal located and on the /usr mount, but it just will not accept any location I give it. What exactly does this check when I enter a path on the PHP/Java Bridge module page?
Comment #14
infojunkieGiven a path, it checks if the file
[path]/java/Java.incexists. Was this running correctly on Tomcat 6?Also, did you try my last suggestion on Tomcat 6 before switching to 5.5 ?
Comment #15
spivey commentedOk - I fixed the code and tried the example in post 11, I received the same spreadsheet example as before.
Comment #16
infojunkieThat is good news: your PHP/Java Bridge installation works well, and the bug is somewhere in Sheetnode ;-)
Can you please find the value of the Drupal variables called "sheetnode_xls_jar" and "sheetnode_xls_jar_path" ? You can find them in the database, table "variable", and search for records where field "name" LIKE "%sheetnode%".
The "sheetnode_xls_jar" variable should contain the same string that you entered manually to replace
"<full path of each jar in POI folders separated by semicolon>". Are they the same?Comment #17
spivey commentedListed first in the query results is sheetnode_xls_jar, with the path to each jar file following seperated by ';'
The next entry in the table is sheetnode_xls_jar_path, with the correct path to POI following.
This path is the same that I used in the last test code you posted.
Comment #18
infojunkieI'm running out of ideas...
What is the error you now get? Anything in the PHP/Java Bridge log file or Drupal status report? Which POI version are you using?
If you'd like me to check your installation, I can do that.
Comment #19
spivey commentedI started out with:
Fatal error: Class 'org_apache_poi_hssf_usermodel_HSSFWorkbook' not found in /var/www/aqcomm/addmods/sheetnode/sheetnode_xls.export.inc on line 18
Changing this -
new org_apache_poi_hssf_usermodel_HSSFWorkbook() : new org_apache_poi_xssf_usermodel_XSSFWorkbookto this
new java("org.apache.poi.hssf.usermodel.HSSFWorkbook") : new java("org.apache.poi.xssf.usermodel.XSSFWorkbook")now gives me this:
Fatal error: Class 'org_apache_poi_ss_usermodel_Cell' not found in /var/www/aqcomm/addmods/sheetnode/sheetnode_xls.export.inc on line 97
Nothing in the logs (apache or php/java Bridge - in fact the latter is empty). POI is 3.5 FINAL.
Comment #20
infojunkieIt seems that
java_autoloadfails to find the Java class. Here are some more tests:* What's your PHP version?
* In sheetnode_xls.export.inc, please replace
with
Any difference?
* Edit your java/Java.inc, function
java_autoload_function5, by replacing:with
i.e., commenting it out. What happens now?
Comment #21
spivey commentedPHP 5.2.6-1
require_once("java/Java.inc");Results in:
Fatal error: require_once() [function.require]: Failed opening required 'java/Java.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/aqcomm/addmods/sheetnode/sheetnode_xls.export.inc on line 6
I roll back that change and
//if(!($client->invokeMethod(0, "typeExists", array($str)))) return false;I still receive
Fatal error: Class 'org_apache_poi_ss_usermodel_Cell' not found in /var/www/aqcomm/addmods/sheetnode/sheetnode_xls.export.inc on line 97
Comment #22
infojunkie2 things are inconsistent still:
* The code
require_once("java/Java.inc");works in the non-Drupal examples above, but not in the Sheetnode module.* The autoloaded class
org_apache_poi_hssf_usermodel_HSSFWorkbookis found in the non-Drupal example, while it's not found in the Sheetnode module.If we can resolve those inconsistencies we'll solve this problem :-)
Comment #23
spivey commentedI removed the modules from Drupal and deleted to directories on the server they were in. I downloaded the tar ball again and set everything back up - but still the same error.
This question might be unrelated but - when creating the feed view it asks for a path - when I assign the path 'casetracker' I do not get an error, but I also don't get a xls file. If I assign a path of xls_export (one that doesn't already exist) I do get the error. Is this correct?
Comment #24
infojunkie> This question might be unrelated but - when creating the feed view it asks for a path - when I assign the path 'casetracker' I do not get an error, but I also don't get a xls file. If I assign a path of xls_export (one that doesn't already exist) I do get the error. Is this correct?
I would think so. If the path already exists then it's probably picking up the other definition and thus the XLS exporting code is never called.
Comment #25
spivey commentedSorry to take so long on this but that box was giving me some issues. I went ahead and loaded a fresh OS install on a different box and a new install of Drupals. I haven't loaded any other modules except for this one (and what it requires). I'm still getting the same error that I first reported :
Fatal error: Class 'org_apache_poi_hssf_usermodel_HSSFWorkbook' not found in /var/www/aqcomm/addmods/sheetnode/sheetnode_xls.export.inc on line 18
So I go in and change
org_apache_poi_hssf_usermodel_HSSFWorkbookto
org.apache.poi.xssf.usermodel.XSSFWorkbookas you suggested in post #6, and still get the other error that references line 97.
Comment #26
spivey commentedI've been hacking around at this and managed to get a spreadsheet download - but here is the contents:
Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new . Cause: java.lang.ClassNotFoundException: VM: 1.6.0_12@http://java.sun.com/" at:
#-8 java.lang.Class.forName0(Native Method)
#-7 java.lang.Class.forName(Class.java:247)
#-6 php.java.bridge.StandaloneJavaBridgeClassLoader.forName(StandaloneJavaBridgeClassLoader.java:137)
#-5 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:449)
#-4 php.java.bridge.Request.handleRequest(Request.java:453)
#-3 php.java.bridge.Request.handleRequests(Request.java:491)
#-2 php.java.bridge.http.ContextRunner.run(ContextRunner.java:145)
#-1 php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60)
#0 /opt/tomcat/webapps/JavaBridge/java/Java.inc(128): java_ThrowExceptionProxyFactory->getProxy(28, 'org.apache.poi....', 'T', false)
#1 /opt/tomcat/webapps/JavaBridge/java/Java.inc(211): java_Arg->getResult(false)
#2 /opt/tomcat/webapps/JavaBridge/java/Java.inc(212): java_Client->getWrappedResult(false)
#3 /opt/tomcat/webapps/JavaBridge/java/Java.inc(312): j in /opt/tomcat/webapps/JavaBridge/java/Java.inc on line 109
Have I gone a step forward, or 2 back?
Comment #27
infojunkieThe exception report you sent does not contain the class name. Specifically, the line
should contain the class name, but it's shortened. Can you find the full version?
Also, you can send your modified file here for me to look at it. I might spot obvious defects.
Comment #28
spivey commentedWhere? Is there another log file I can look in?
I've attached sheetnode_xls.export.inc - I added the .info just to upload here.
Comment #29
spivey commentedFound this log from tomcat
Comment #30
infojunkieYour translation of
to
is incorrect. Instead, you need to change
to
Comment #31
infojunkieCan I access your site and/or server to see for myself? I might find something obvious...
Comment #32
spivey commentedorg.apache.poi.hssf.usermodel.HSSFWorkbookWhich instance? The only one I could find to change was:
$workbook = $type == 'xls' ? new java("org.apache.poi.hssf.usermodel.HSSFWorkbook") : new java("org.apache.poi.xssf.usermodel.HSSFWorkbook");That is how it now reads.
The site is still internal, so there isn't any outside access right now.
/edit:Update - with that code changed I still get the same error.
Comment #33
infojunkieI meant all instances of such classes. I will send you a file within a few hours with the proper changes.
Comment #34
infojunkieAttached is a version of sheetnode_xls.export.inc that I tested successfully. Please let me know if it works for you.
Comment #35
spivey commentedUsing that I'm getting a spreadsheet with the contents:
<b>Fatal error</b>: Class 'java_io_ByteArrayOutputStream' not found in <b>/var/www/aqcomm/addmods/sheetnode/sheetnode_xls.export.inc</b> on line <b>80</b><br />Comment #36
infojunkieTry this one please :-)
Comment #37
spivey commentedHey hey!! That did it!
What did you have to change?
Comment #38
infojunkiePhew! I changed every Java class occurrence from the form
x_y_z_ClassName(that relied onjava_autoload()working correctly) tojava('x.y.z.ClassName').I don't want to close this issue though, because
java_autoload*should* be working correctly. I will post a message on the PHP/Java Bridge mailing list to ask about cases wherejava_autoloadmight fail. Otherwise, all other Java-related files (XLS import, ODS export) would need the same treatment :-(Thanks a lot for your patience with this issue.
Comment #39
infojunkieComment #40
infojunkieI see you contacted PJB already! I just subscribed to this mailing list, so can you please reply to your own message so that I can join that thread (instead of starting a new one)?
Comment #41
infojunkieTo summarize the response made on the PJB mailing list: it seems you're using PJB 5.5.4 where they removed support for classes declared as
x_y_z_ClassName. They will revert that change in the next release 5.5.4.1. I suggest that we resume this thread once this new version is released.On my side, I will make sure that my module no longer depends on the presence of the java.so extension, or php.ini settings.
Comment #42
ranvir.prasad commentedSubscribing.
Does the new version not rely on java.so or java_dll extension? PHP/Javabridge site points out that servlet model is better than using java.so or java_dll part.
Comment #43
infojunkie@ranvir: I haven't yet updated the module to not depend on java.so/dll. I will make a new release once this is implemented and tested. In the meantime, you can modify the code in php_java_bridge.install, function
php_java_bridge_requirements, by replacing the linewith
All remaining settings should be the same as described on the module page.
Comment #44
spivey commentedJust to let you know that wasn't me that started the thread at PJB; but it is a little reassuring I wasn't the only one having the same problem.
Thanks for your work on this.
Comment #45
nsoules1 commentedHi All,
I'm the person that posted the thread on PJB. I listened to Peter's suggestion, which is what Kratrib has passed along here:
// $extension = extension_loaded('java');
$extension = TRUE;
This really helped, and I was able to install the php-java-bridge module and then the xls sheetnode module. Now, however, I'm running into some errors when trying to import an xls file:
"java.lang.Exception: Invoke failed: [[c:WorkbookFactory]]->create((o:InputStream)[o:FileInputStream]). Cause: java.lang.NoSuchMethodError: org.apache.poi.poifs.filesystem.POIFSFileSystem.hasPOIFSHeader(Ljava/io/InputStream;)Z VM: 1.6.0_16@http://java.sun.com/" at: #-10 org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:59)
I'm thinking that this may be related to this thread, so I tried this:
// $workbook = org_apache_poi_ss_usermodel_WorkbookFactory::type()->create($inp);
$WbClass = new java_class('org.apache.poi.ss.usermodel.WorkbookFactory');
$workbook = $WbClass->create($inp);
Didn't seem to make a difference... however I did not change how $inp was getting initialized (I don't see an error associated with it). Not sure how to pass in a param w/ single quotes using that syntax.
Also, it may be worth noting that I cannot get the php and jsp samples for PhpJavaBridge to work at the same time. I have an Apache-Tomcat connector, and when I enable this for JavaBridge, the jsp examples work, but the php examples do not. If I have it disabled, the php examples work, but jsp examples don't. Is that normal? Will the JavaBridge still function/function well enough for sheetnode to work? (Sorry if that's more of a PhpJavaBridge question)
Any help would be appreciated. Thanks!
Comment #46
infojunkie@nsoules1, please open a separate issue because this seems to have nothing to do with the extension problem.
Comment #47
nsoules1 commentedKratib - ok, opened a new one.
Comment #48
infojunkieComment #49
infojunkieThe latest 1.5-beta3 version has removed the Java dependencies and replaced them with PHPExcel library. Please delete your sheetnode folder and install the latest version as per the instructions on the module page.