ZAV79
August 29, 2019, 12:27pm
1
Hi,
I have recently migrated a site from a Lucee 4.5 to Lucee 5.3 server. (On windows, Tomcat 9, Java 11)
I am having trouble with using third party jar files, it was working fine, and all the same jar files are in the folder: \WEB-INF\lucee\lib
I’ll use the azure storage library for example, but this happens with a couple of different libraries.
When I load an object from a package such as:
<cfset LOCAL.CloudStorageAccount = CreateObject("java","com.microsoft.azure.storage.CloudStorageAccount" ).parse(variables.connectionString)>
I will get a java.lang.NoClassDefFoundError for one of the other classes in the package that this command would use. In this example it is:
Could not initialize class com.microsoft.azure.storage.core.Utility
Lucee is obviously finding the package, or CreateObject(“java”,“com.microsoft.azure.storage.CloudStorageAccount” ) wouldn’t work.
And I can look in the jar, and see that com.microsoft.azure.storage.core.Utility is inside the package.
I have tried both the original jar files from the old server, and the latest version of the package downloaded from maven, but the result is the same.
Can anyone think of what I might be doing wrong or what might be happening?
Thanks
Zav
ZAV79
August 29, 2019, 2:07pm
2
Ok, I solved this myself, well, at least found a work around for anyone struggling like me.
If I explicitly specify all the dependent packages in the createObject, it works:
I.e.
<cfset **variables.classpathstest**=
[
'Z:\pathToSite\htdocs\WEB-INF\lucee\lib\azure-storage-8.4.0.jar',
'Z:\pathToSite\htdocs\WEB-INF\lucee\lib\azure-keyvault-core-1.0.0.jar',
'Z:\pathToSite\htdocs\WEB-INF\lucee\lib\commons-lang3-3.4.jar',
'Z:\pathToSite\htdocs\WEB-INF\lucee\lib\guava-20.0.jar',
'Z:\pathToSite\htdocs\WEB-INF\lucee\lib\jackson-core-2.9.4.jar',
'Z:\pathToSite\htdocs\WEB-INF\lucee\lib\slf4j-api-1.7.12.jar'
]>
<cfset LOCAL.CloudStorageAccount = CreateObject("java","com.microsoft.azure.storage.CloudStorageAccount",**variables.classpathstest**).parse(variables.connectionString)>
1 Like
ZAV79
August 30, 2019, 10:49am
3
Ok, I thought this had worked, but after restarting TomCat, I am back to it not working again, with the same error.
The jar files were not changed or moved between it working and not working, just the restart of TomCat
Anyone got any other thoughts?
using java 11? try java 1.8
ZAV79
August 30, 2019, 1:43pm
7
Certainly sounds familiar, but I have double checked and i’m it still happens on Java 1.8, I have also checked: Info - Bundle (jar) page in web administrator and all dependent packages are listed as loaded and active.