-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.io.FileInputStream incompatible with org.apache.poi.openxml4j.opc.OPCPackage #213
Comments
Hi Ivan. I don't really know. I've run the test suite with that version of Lucee and it passes ok. There must be a difference somewhere between your environments. Are you reading the same spreadsheet file in both dev and production? Is it an xls or xlsx file? |
hi. I thought about a permissions issue and set permissions 777 on the xlsx file, but it didn't solve. what other tests could I do? |
Sorry, I don't know what else to suggest. The OPCPackage class is internal to POI, but if the environment and parameters are the same then I would expect it to behave in the same way. |
Is it possible the file is password protected? I think OPCPackage is normally only needed for encryption. Does the code work on your prod server with a simple test xls/xslx file? |
hi @cfsimplicity,
1840: var file = CreateObject( "java", "java.io.FileInputStream" ).init( arguments.path );
1841: if( arguments.KeyExists( "password" ) ) return loadClass( className ).create( file, arguments.password );
1842: return loadClass( className ).create( file );
1843: }
1844: } I don't understand what I'm doing wrong ... |
Ivan, the error is coming from the POI class not the Spreadsheet library, which is just loading that class. Is it just that particular file that is problematic? Does it work with a simple test file on your production server? |
i also tried with a new one line xlsx file but i have the same problem ... |
In that case there must be something different about your prod environment. Sorry but I can't tell you what that might be. |
By default the library should use the JavaLoader package which ships with it in the same directory. Even if it was using the mapped JavaLoader elsewhere on your server, I'd expect it to behave in the same way. |
you won't believe it but I solved it by doing a reboot of the production server (it was already scheduled) ... this job is really demoralizing ... 😢 thanks anyway for the support! |
hi @cfsimplicit, i'm getting exactly the same error ... 😭 i just don't know how to fix ... if you have any ideas, just let me know. |
Is it possible the Lucee installation on the server is loading POI jars from anywhere else? Try adding the following script to check the location of the jars being loaded:
It should point to a jar inside the /lib folder within the spreadsheet library folder. PS: run it just before the line which is erroring. |
this is the result of the dump:
|
That looks correct. How about: |
To rule out a problem with the server mapped JavaLoader instance you mentioned earlier, you could explicitly point the library to the version bundled with it.
|
hi, first of all sorry for the delay. I did the tests you indicated: function test( struct rc = {} ) localmode="modern"{
spreadsheet = new com.spreadsheet.Spreadsheet( javaLoaderDotPath: "bundledJavaLoader.JavaLoader" );
dump( spreadsheet.getEnvironment().javaLoaderDotPath );
spreadsheet.flushPoiLoader();
dump( spreadsheet.getEnvironment().javaLoaderDotPath );
spreadsheet.dumpPathToClass( "org.apache.poi.openxml4j.opc.OPCPackage" );
q_catalog = spreadsheet.read(src='/var/www/mywebsite/app/media/schedule/catalog/Referenze.xlsx', headerRow=1, format="query");
dump( q_catalog );
abort;
} and this is the error (referring to the line
I really don't know why this error comes up. ... for the moment I have rewritten the function that does the manipulation of the xlsx file in python (callable with |
OK, no change then. As I say it was just to rule out a problem with the JavaLoader mapping. Thanks for posting the full stack trace. That shows where the error is happening, which is inside the POI java classes. I don't understand why the OPCPackage class is being invoked when the file is being read, or why it's rejecting the FileInputStream. But I didn't write that code. A proper java expert would probably know. Glad you've been able to work around it for now. Let's leave this ticket open in case anything comes up to shed any light on it. |
@ivanionut It might be worth trying the latest release 2.14.0 which uses a new version of POI and no longer requires JavaLoader to load it in Lucee. |
hi thanks! |
Hello @cfsimplicity,
I'm having an error in the production environment but in my development environment (which uses the same stack) it works fine.
this is the error:
what am I doing wrong?
The text was updated successfully, but these errors were encountered: