我正在开发一个 Mollom 验证码实现(作为一个组件),我需要为此创建一个 OSGI 包。我使用 eclipse 创建了一个(因为它需要几个 jar 才能正确编译)。虽然包的创建没有任何错误,但当我将 jar 上传到 OSGi 控制台时,它只是没有启动。我打开了error.log,我发现:-
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
问题是,我的 jar确实包含一个激活器类(自动生成的)。
这是我的清单文件:-
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
我知道将 lib 添加到类路径不是最佳实践,但我怀疑这些包含的 jar 中的任何一个都将在我的 Mollom Captcha 服务之外使用,所以我选择了它。
我认为我的错误与我设置类路径的方式有关。
谁能指出我正确的方向?