1

大家好,我在 karaf 中使用 feture install 时遇到以下错误

org.apache.karaf.features.internal.util.MultiException: Error
    at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.<init>(MavenDownloadManager.java:84)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.download.impl.MavenDownloadManager.createDownloader(MavenDownloadManager.java:72)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:358)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:355)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:191)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[9:org.apache.karaf.features.core:4.0.3]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]
Caused by: java.lang.Exception: Unable to create resource for bundle mvn:org.dt.dummy/Diff-Blueprint/0.0.1-SNAPSHOT
    at org.apache.karaf.features.internal.region.Subsystem.createResource(Subsystem.java:567)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.region.Subsystem$1.downloaded(Subsystem.java:376)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader$1.operationComplete(MavenDownloadManager.java:133)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader$1.operationComplete(MavenDownloadManager.java:127)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.download.impl.DefaultFuture.notifyListener(DefaultFuture.java:344)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.download.impl.DefaultFuture.notifyListeners(DefaultFuture.java:329)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.download.impl.DefaultFuture.setValue(DefaultFuture.java:255)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.download.impl.AbstractDownloadTask.setFile(AbstractDownloadTask.java:61)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:59)[9:org.apache.karaf.features.core:4.0.3]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_79]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_79]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_79]
    ... 3 more
Caused by: org.osgi.framework.BundleException: Unable to build resource for mvn:org.dt.dummy/Diff-Blueprint/0.0.1-SNAPSHOT: Unsupported 'Bundle-ManifestVersion' value: 1
    at org.apache.karaf.features.internal.resolver.ResourceBuilder.build(ResourceBuilder.java:80)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.resolver.ResourceBuilder.build(ResourceBuilder.java:69)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.region.Subsystem.createResource(Subsystem.java:565)[9:org.apache.karaf.features.core:4.0.3]
    ... 15 more
Caused by: org.osgi.framework.BundleException: Unsupported 'Bundle-ManifestVersion' value: 1
    at org.apache.karaf.features.internal.resolver.ResourceBuilder.doBuild(ResourceBuilder.java:88)[9:org.apache.karaf.features.core:4.0.3]
    at org.apache.karaf.features.internal.resolver.ResourceBuilder.build(ResourceBuilder.java:78)[9:org.apache.karaf.features.core:4.0.3]
    ... 17 more

特征.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="Diff-Blueprint">
    <feature name="Diff-Blueprint" description="Diff-Blueprint" version="0.0.1.SNAPSHOT">
        <feature prerequisite="true" dependency="false">wrap</feature>
        <bundle>mvn:org.dt.dummy/Diff-Blueprint/0.0.1-SNAPSHOT</bundle>
        <bundle>wrap:mvn:osgi/osgi/3.0.1</bundle>
        <bundle>wrap:mvn:javax.xml/xml/3.1.0</bundle>
        <bundle>wrap:mvn:xmlunit/xmlunit/1.6</bundle>
        <bundle>wrap:mvn:junit/junit/4.11</bundle>
        <bundle>wrap:mvn:org.hamcrest/hamcrest-core/1.3</bundle>
        <bundle>mvn:com.googlecode.json-simple/json-simple/1.1.1</bundle>
        <bundle>wrap:mvn:de.odysseus.staxon/staxon-jackson/1.2</bundle>
        <bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.0.6</bundle>
        <bundle>wrap:mvn:de.odysseus.staxon/staxon/1.2</bundle>
        <bundle>mvn:log4j/log4j/1.2.17</bundle>
        <bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.13</bundle>
        <bundle>mvn:org.codehaus.jackson/jackson-core-asl/1.9.13</bundle>
        <bundle>wrap:mvn:org.unitils/unitils/2.4</bundle>
        <bundle>wrap:mvn:commons-logging/commons-logging/1.1</bundle>
        <bundle>wrap:mvn:commons-dbcp/commons-dbcp/1.2.2</bundle>
        <bundle>wrap:mvn:commons-pool/commons-pool/1.3</bundle>
        <bundle>wrap:mvn:commons-lang/commons-lang/2.3</bundle>
        <bundle>wrap:mvn:commons-collections/commons-collections/3.2</bundle>
        <bundle>wrap:mvn:ognl/ognl/2.6.9</bundle>
        <bundle>wrap:mvn:ant/ant/1.6.5</bundle>
    </feature>
</features>
4

4 回答 4

6

感谢我在这里复活了一个旧线程,但要详细说明@Charity 的答案,对于以后发现这个问题的任何人(就像我所做的那样)......

问题是我们正在尝试将不符合 OSGi 的捆绑包部署到容器中。解决方案是使用OPS4J Wiki中描述的 Wrap 协议来“包装”导致问题的包。

JAR 示例

一个使用 Maven 的简单示例如下所示:

wrap:mvn:commons-logging/commons-logging/1.1

请注意,我们必须在包前面加上“wrap:”,仅此而已。有关覆盖清单中定义的设置的更复杂示例,请参阅 wiki。

战争示例

以几乎相同的方式部署非 OSGi 兼容的 WAR 文件,改为使用“webbundle”URI 处理程序:

webbundle:mvn:com.example/example-web-app/1.0/war
于 2019-07-23T13:19:58.583 回答
1

如果我们包装抛出 Bundle-ManifestVersion: 1 的罐子,我找到了一个解决方案,那么这将起作用

于 2016-02-11T10:51:07.177 回答
0

显然,该Diff-Blueprint捆绑包具有Bundle-ManifestVersion: 1MANIFEST.MF 标头。这表明它早于 2005 年发布的 OSGi Release 4.0,因此 Karaf 的现代版本不支持它也就不足为奇了。

因此,您必须查看生成该捆绑包的工具。

于 2016-02-05T16:31:57.987 回答
0

尝试编辑有问题的捆绑包的 MANIFEST.MF 文件,只需将
Bundle-ManifestVersion 的值更改为 2 而不是 1。

于 2016-02-09T10:02:30.030 回答