Need help using Sardine Java package in Lucee

I have reached the limit of my knowledge of using a java library in Lucee and need help.
(I have zero experience writing java which is probably the majority of my problem)

OS: Linux (3.10.0-957.21.2.el7.x86_64) 64bit
Java Version: 11.0.3 (AdoptOpenJDK) 64bit
Tomcat Version: 9.0.20
Lucee Version: 5.3.2.77

What I would like to do is to use Sardine to read from Sharepoint WebDav resource. Here is the link to the project https://github.com/lookfirst/sardine

What I’ve done is download sardine 5.10 jar into {website}\WEB-INF/lucee/lib

Now when I run this code:

<cfscript>
	sfactory = createObject("java", "com.github.sardine.SardineFactory"); 
	sardine = sfactory.begin("user","password");
	resources = sardine.list("http://fhc-sharepoint/Vault/DMRDocuments");
</cfscript>

I get this error


Lucee 5.3.2.77 Error (java.lang.NoClassDefFoundError)
Message javax/xml/bind/JAXBException
Stacktrace The Error Occurred in
**/var/lucee/infor_dev/vault.cfm: line 246**

> 244: sfactory = createObject("java", "com.github.sardine.SardineFactory");
> 245: sardine = sfactory.begin("user","password");
> **246: resources = sardine.list("http://fhc-sharepoint/Vault/DMRDocuments");**
> 247: </cfscript>
> 248:
Java Stacktrace lucee.runtime.exp.NativeException: javax/xml/bind/JAXBException
  at com.github.sardine.impl.SardineImpl.propfind(SardineImpl.java:459)
  at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:409)
  at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:399)
  at com.github.sardine.impl.SardineImpl.list(SardineImpl.java:393)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method

Goggling around it seems that something called JAXAB has been removed from JDK and put somewhere else but I’m not sure how to load it with an OSGi extended createobject or finding what Jar files come to put in /lib/

Does anyone know what I need to do?

I figured I would start here as the package developer is not likely to know Lucee - any help would be greatly appreciated

Andy
Bowdoin, Maine USA

Based on the NoClassDefFound error, it would appear the Sardine lib has a Java class dependency that you have not included on the classpath. You appear to be missing the jaxb-api library. Based on Sardine’s dependencies listed in its pom.xml, you can find that here: https://search.maven.org/artifact/jakarta.xml.bind/jakarta.xml.bind-api.

There are other dependencies listed that you may need to include. See: https://search.maven.org/artifact/com.github.lookfirst/sardine/5.10/jar

You can identify them by looking in the “Dependencies” block of the XML (omitting any marked for ant of testing) or in the “Dependencies” section to the right of the page under the list of build tool examples.

You could also fix the issue, by building the sardine.jar with all dependencies and include that one.

Otherwise you need to include all dependencies with the correct version. I guess thats harder to maintain, if you are using multiple librarys which may use the same dependency with another version.

Try the latest RC, lots of java loading related stuff has been resolved since 5.3.2