java.lang.NoClassDefFoundError for org/apache/http/config/Lookup

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="" name="service">

When I call service.init() It fails with the error:
Lucee 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: Still get the same error. I’m not sure what else to try.

I’m running version Lucee 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.

1 Like

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.

stacktrace.txt (4.9 KB)

intressting, i will try to reproduce asap, can you link the jars you are using? best as a

I had to break it up. are the dependencies. In desperation I also added those files dependencies (, unsure if that is necessary. (1.8 MB) (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.

FYI the http libs already exists as OSGi libs|gav|1|g%3A"org.lucee"%20AND%20a%3A"httpcomponents-httpclient"|gav|1|g%3A"org.lucee"%20AND%20a%3A"httpcomponents-httpmime"|gav|1|g%3A"org.lucee"%20AND%20a%3A"httpcomponents-httpcore"

also for sure joda, commons-codec, log4j exist as OSGi libs

I’ve just got some learning to do. The EWS jar is also in the maven repository:||ews-java-api|2.0|jar

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.

here an example of a generated project

NIfty. I may pursue a similar approach. Thanks for all the help!

I was able to create a bundle in Eclipse (MARS) using some examples I found and I have everything working in Lucee.

  • File > New > Project-> Plug-in from existing JARs.
  • Project name: OSGI_EWS
  • Under ‘jars to include in this plugin’ I added all the jars using add external button
  • Target OSGI framework->Standard
  • Finish
  • On the runtime tab for I only export the packages
  • File Export->Plugin development->Deployable plugins and fragments, choose destination
  • grabbed jar file from plugins subfolder
  • Put in lucee\tomcat\lucee-server\bundles
  • restarted lucee
  • It shows in lucee admin in info->Bundle (jar) as not loaded

I’m able to create the service using:

I’m not certain adding ALL the jars in the plugin was the right way to go about it, but I couldn’t get it to work otherwise.

1 Like

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 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.

Did anyone discover more about this per chance?

i always use see all the dependencies, have in mind that the jars bundled also can have dependencies, so you need to follow down the rabbit hole.
In addition all classes you are using need to be imported in the manifest or at least have a “require-bundle”

a bundle only see bundles it imports statically or dynamically

Looking to make a start on using this Java library ourselves, any guidance on how to set it up would be really appreciated. Thanks.