我正在开发Mollom验证码实现(作为组件),我需要创建一个OSGI包。我使用eclipse创建了一个(因为它需要更多的jar以便正确编译)。尽管创建的bundle没有任何错误,但是当我将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 DOES 包含一个激活器类(自动生成的类)。
这是我的清单文件: -
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服务之外使用,所以我选择了它。
我认为我的错误与我设置类路径的方式有关。
有人能指出我正确的方向吗?
答案 0 :(得分:4)
这部分看起来很可疑:
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-Classpath,以便找到您的激活器(可能位于JAR_ROOT/com/mollom/client/Activator.class
下)。
更一般的提示:为什么不使用maven-bundle-plugin来准备捆绑包和正确的清单文件? Embed-Dependency
选项允许包含所有这些额外的罐子。