Skip to Content

How to deal with external libraries when developing IoT Gateway Interceptor?

Jan 08 at 11:35 AM


avatar image
Former Member

I am currently developing an IoT Gateway Interceptor using some external libraries such as libraries related to org.apache.http.client.*. When testing the interceptor on my local machine in eclipse without the gateway, everything works as planned, but when executed as an OSGi bundle within the Gateway, only the InterceptorActivator starts up but no message of the actual interceptor is found in the log. There are just dozens of error messages in the error log in folder "configuration" of the type "java.lang.NoClassDefFoundError: org/apache/http/client/ [...]".

I figure that somehow the included libraries went missing when building the OSGi bundle / when clicking "Build Iot Interceptor in Eclipse.

Thanks in advance for your help!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member
Jan 10 at 11:15 AM

Hi Fabian,

we'll look into the behavior you obtain exporting the bundle through the "Build Iot Interceptor in Eclipse" button. In the meantime could you follow this alternative way to configure and export your bundle?

Project setup

  • 1.Add the library to the build path: right-click on project -> build path -> configure build path -> add external jar. For convenience, place the jar within a “lib” folder under the project main folder
  • 2.Add the Bundle-classpath directive to the Manifest file, including the library placed under the “lib” folder (e.g. Bundle-ClassPath: .,lib/org.eclipse.paho.client.mqttv3-1.2.0.jar)
  • 3.Modify the adding the “lib” folder: this allows to include the third-party jar when building the interceptor project. A resulting file would look as follows

source.. = src/

bin.includes = META-INF/,\




Building the project

Right-click on the project -> export -> deployable plug-in and fragments -> next. Select the interceptor project, then click on “finish”.

10 |10000 characters needed characters left characters exceeded