Osgi 无法将捆绑包自动部署到Karaf
我正在开发一个基于OSGI的应用程序,它部署到Karaf容器中。Karaf具有自动部署功能,将捆绑包复制到其Karaf/deploy目录应自动将该捆绑包部署到容器中。但是,在将捆绑包复制到部署目录时,我经常会遇到类似于以下错误的情况:Osgi 无法将捆绑包自动部署到Karaf,osgi,apache-karaf,osgi-bundle,autodeploy,Osgi,Apache Karaf,Osgi Bundle,Autodeploy,我正在开发一个基于OSGI的应用程序,它部署到Karaf容器中。Karaf具有自动部署功能,将捆绑包复制到其Karaf/deploy目录应自动将该捆绑包部署到容器中。但是,在将捆绑包复制到部署目录时,我经常会遇到类似于以下错误的情况: org.osgi.framework.BundleException: Bundle symbolic name and version are not unique: legacy-services-impl:8.0.0.ALPHA-SPRINT9-SNAPSH
org.osgi.framework.BundleException: Bundle symbolic name and version are not unique: legacy-services-impl:8.0.0.ALPHA-SPRINT9-SNAPSHOT
at org.apache.felix.framework.BundleImpl.createRevision(BundleImpl.java:1225)
at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:95)
at org.apache.felix.framework.Felix.installBundle(Felix.java:2979)
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:1030)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:944)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:857)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:483)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
org.osgi.framework.BundleException:捆绑包符号名称和版本不唯一:遗留服务impl:8.0.0.ALPHA-SPRINT9-SNAPSHOT
位于org.apache.felix.framework.BundleImpl.createRevision(BundleImpl.java:1225)
位于org.apache.felix.framework.BundleImpl.(BundleImpl.java:95)
位于org.apache.felix.framework.felix.installBundle(felix.java:2979)
位于org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
在org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:1030)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
在org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:944)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
在org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:857)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
在org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:483)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
在org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
容器告诉我,我正在尝试部署一个重复的捆绑包,而不是重新部署一个已经部署的捆绑包
Karaf确实部署了该捆绑包,但为什么不重新部署该捆绑包呢?是什么导致了这种行为?如何在自动部署时避免此类错误
谢谢,
Michael我怀疑您的包没有正确停止。这可能就是卡拉夫认为它还在那里的原因。您的激活器中是否有停止时执行的代码?也许您也在运行一些线程。您应该确保activator的stop方法工作正常,并干净地关闭所有资源并停止包中的所有线程。您使用的是哪个版本?顺便说一句,在用户列表上问这个问题通常会给你一个更快更好的反馈:-)阿希姆,这是Karaf和Fuse捆绑的(2.3.0.Fuse-71-047)。如何访问用户列表?Karaf用户列表可从以下网址获得: