I’m trying to do some test code to work with the Exchange Web Service so we can ditch cfexchange and migrate from ACF to Lucee. I’ve installed ews-java-api-2.0.jar in Lucee (and restarted). I can instantiate the service fine: <cfobject type="Java" class="microsoft.exchange.webservices.data.core.ExchangeService" name="service">
When I call service.init() It fails with the error:
Lucee 5.2.8.50-RC Error (java.lang.NoClassDefFoundError)
Message org/apache/http/config/Lookup
Which makes me think it is a dependency error. When I add
httpclient-4.4.1.jar and httpcore-4.4.1.jar and restart Lucee, I still get the error (Plus, I’m pretty sure Lucee already has these built in). Just to be thorough, I added all the dependencies listed here and all THEIR dependencies: https://mvnrepository.com/artifact/com.microsoft.ews-java-api/ews-java-api/2.0. Still get the same error. I’m not sure what else to try.
I’m running version Lucee 5.2.8.50-RC on Windows Server 2012 and I am using IIS 8.5.
Could it be that the ews-java-api.jar was compiled with Java 6 and Lucee is using Java 8? If so what would be a good path foward to resolve the issue or what other alternatives are there for making calls to a web service like EWS from java/Lucee?
not sure what you mean with “installed”, but assuming you did simply copy the jar to the lib folder.
If that is the case forget “Plus, I’m pretty sure Lucee already has these built in”, Lucee loads the jars as OSGi bundles, that means only the lucee core itself sees this jars and not a class that is loaded in a classic way.
That gives you the option to add the jars in any version you likes, but you need to add the jars you need.
In many cases an exception like this is a cascade, so the stacktrace shows “caused by …”, please post the complete stacktrace.
And yes you can of course also load the jars as OSGi bundles.
as a sidenote, the lucee core does not use this jars, only the Lucene extension does, so in other words only jars loaded by this extension to see that jars
Pretty cool that that is the way it works. I may be a little out of my depth. OSGi looks interesting. I added all the dependencies back, ran it again. Slightly different error for org/apache/http/conn/HttpClientConnectionManager.
I had to break it up. Java.zip are the dependencies. In desperation I also added those files dependencies (Java2.zip), unsure if that is necessary. java.zip (1.8 MB) java2.zip (1.8 MB)
I think I am making progress. Previously I dumped the jars in lucee\tomcat\webapps\ROOT\WEB-INF\lucee\lib. Now I have made a separate folder, added an application.cfc and I am specifying a load path: <cfset this.javasettings={LoadPaths = ["D:/ewsjars"], loadCFMLClassPath = true}>
I can now call service.init() and cfdump the service to inspect it. I’ve got new unrelated errors to deal with, but I am on my way!
I’m not clear how this is different than putting them in the lib folder. You’ve set me on the path on trying to figure out how to make this into an OSGi bundle when I get it working.
I’ve just got some learning to do. The EWS jar is also in the maven repository:
But I guess it is just a jar, not a bundle, based on the information here:
By looking at the manifest for the links you posted I can tell they are OSGi bundles. Without looking at the manifest file it does not seem obvious that they are bundles.
parts are OSGI, parts are not. i have an application that creates a maven project that can convert a regular jar hosted on maven to a OSGi jar, then also hosted on maven.
We have Lucee 4.5.5 using the EWS API – on Lucee 5 however, I’m running into similar issues described above. The jars are loaded - its just some of the microsoft.exchange.webservices.data classes seem unavailable?
I’ve tried to bundle as a plugin - but as of yet to no avail. Seems odd that we’d need to do this though.