Question

I am working on a Mollom captcha implementation (as a component), for which I need an OSGI bundle created. I created one using eclipse (because it required a couple of more jars so as to compile correctly). Although the bundle was created without any errors, when I upload the jar onto the OSGi console, it just does not start. I opened up error.log and I find this:-

27.09.2013 12:10:33.264 *INFO* [pool-6-thread-34-com/day/cq/replication/job/publish(com/day/cq/replication/job/publish)] com.day.cq.replication.impl.AgentManagerImpl Processing job for agent publish
27.09.2013 12:10:33.265 *INFO* [pool-6-thread-34-com/day/cq/replication/job/publish(com/day/cq/replication/job/publish)] com.day.cq.replication.Agent.publish Sending POST request to http://localhost:4503/bin/receive?sling:authRequestLogin=1
27.09.2013 12:10:33.346 *INFO* [0:0:0:0:0:0:0:1 [1380264033342] POST /system/console/bundles/322 HTTP/1.1] com.mollom.client BundleEvent STARTING
27.09.2013 12:10:33.346 *INFO* [0:0:0:0:0:0:0:1 [1380264033342] POST /system/console/bundles/322 HTTP/1.1] com.mollom.client BundleEvent STOPPING
27.09.2013 12:10:33.346 *INFO* [0:0:0:0:0:0:0:1 [1380264033342] POST /system/console/bundles/322 HTTP/1.1] com.mollom.client BundleEvent STOPPED
27.09.2013 12:10:33.346 *ERROR* [0:0:0:0:0:0:0:1 [1380264033342] POST /system/console/bundles/322 HTTP/1.1] cqse-httpservice %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Not found: com.mollom.client.Activator) org.osgi.framework.BundleException: Not found: com.mollom.client.Activator

The thing is, my jar DOES contain an activator class (the auto-generated one).

Here is my manifest file:-

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mollom Client
Bundle-SymbolicName: com.mollom.client
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.mollom.client.Activator
Bundle-Vendor: MOLLOM
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: com.mollom.client,
 com.mollom.client.datastructures,
 com.mollom.client.rest
Bundle-ClassPath: lib/com.sun.jersey.jersey-core-1.4.0.jar,
 lib/jersey-client.jar,
 lib/oauth-client-1.6.jar,
 lib/oauth-signature-1.4.jar,
 src/
Bundle-ActivationPolicy: lazy

I understand that adding lib to the classpath is not best practise, but I doubt any of these included jars are going to be used beyond my Mollom Captcha service, so I went with it.

I think my error has something to do with the way I'm setting my classpath.

Can anyone point me in the right direction?

Was it helpful?

Solution

This part look suspcious:

Bundle-ClassPath: lib/com.sun.jersey.jersey-core-1.4.0.jar,
 lib/jersey-client.jar,
 lib/oauth-client-1.6.jar,
 lib/oauth-signature-1.4.jar,
 src/

You should add . (dot) to the Bundle-Classpath, so your activator (probably placed under JAR_ROOT/com/mollom/client/Activator.class) can be found.

More general tip: why don't you use maven-bundle-plugin to prepare the bundle and proper manifest file? Embed-Dependency option allows to include all these additional jars.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top