gpt4 book ai didi

maven - 无法启动 bundle - 缺少要求(osgi.wiring.package)

转载 作者:行者123 更新时间:2023-12-02 07:20:27 24 4
gpt4 key购买 nike

我是 Apache karaf 和 OSGI 的新手。我正在尝试编写和运行一个非常简单的包。但是我在启动那个包时遇到了这个错误:

Error executing command: Error executing command on bundles: Unable to resolve karaf [86](R 86.0): missing requirement [karaf [86](R 86.0)] osgi.wiring.package; (osgi.wiring.package=bundle) Unresolved requirements: [[karaf [86](R 86.0)] osgi.wiring.package; (osgi.wiring.package=bundle)]

我的 pom 是:4.0.0

<groupId>com</groupId>
<artifactId>karaf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>

<name>karaf Bundle</name>
<description>
karaf OSGi bundle project.
</description>

<properties>
<maven-bundle-plugin.version>2.5.4</maven-bundle-plugin.version>
<osgi.version>6.0.0</osgi.version>
</properties>

<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>${osgi.version}</version>

<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>bundle.Activator</Bundle-Activator>
<Export-Package>
bundle*;version=${project.version}
</Export-Package>
<Import-Package>
org.osgi.framework,*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

我的 manifest.mf 文件在这里。

> Manifest-Version: 1.0
Bnd-LastModified: 1394131053386
Bundle-Copyright: Copyright (c) OSGi Alliance (2000, 2014). All Rights R
eserved.
Bundle-Description: OSGi Core Release 6, Interfaces and Classes for use
in compiling bundles.
Bundle-License: http://opensource.org/licenses/apache2.0.php; link="http
://www.apache.org/licenses/LICENSE-2.0"; description="Apache License, V
ersion 2.0"
Bundle-ManifestVersion: 2
Bundle-Name: osgi.core
Bundle-SymbolicName: osgi.core
Bundle-Vendor: OSGi Alliance
Bundle-Version: 6.0.0.201403061837
Created-By: 1.6.0_45 (Sun Microsystems Inc.)
DynamicImport-Package: *
Export-Package: org.osgi.dto;version="1.0",org.osgi.resource;version="1.
0",org.osgi.resource.dto;version="1.0";uses:="org.osgi.dto",org.osgi.fr
amework;version="1.8",org.osgi.framework.dto;version="1.8";uses:="org.o
sgi.dto",org.osgi.framework.hooks.bundle;version="1.1";uses:="org.osgi.
framework",org.osgi.framework.hooks.resolver;version="1.0";uses:="org.o
sgi.framework.wiring",org.osgi.framework.hooks.service;version="1.1";us
es:="org.osgi.framework",org.osgi.framework.hooks.weaving;version="1.1"
;uses:="org.osgi.framework.wiring",org.osgi.framework.launch;version="1
.2";uses:="org.osgi.framework",org.osgi.framework.namespace;version="1.
1";uses:="org.osgi.resource",org.osgi.framework.startlevel;version="1.0
";uses:="org.osgi.framework",org.osgi.framework.startlevel.dto;version=
"1.0";uses:="org.osgi.dto",org.osgi.framework.wiring;version="1.2";uses
:="org.osgi.framework,org.osgi.resource",org.osgi.framework.wiring.dto;
version="1.2";uses:="org.osgi.dto,org.osgi.resource.dto",org.osgi.servi
ce.condpermadmin;version="1.1.1";uses:="org.osgi.framework,org.osgi.ser
vice.permissionadmin",org.osgi.service.packageadmin;version="1.2";uses:
="org.osgi.framework",org.osgi.service.permissionadmin;version="1.2",or
g.osgi.service.startlevel;version="1.1";uses:="org.osgi.framework",org.
osgi.service.url;version="1.0",org.osgi.util.tracker;version="1.5.1";us
es:="org.osgi.framework"
Import-Package: javax.security.auth.x500;resolution:=optional
Tool: Bnd-2.2.0.20130927-173453

最佳答案

让我们分解一下:“缺少要求”仅表示您的 bundle 已安装到 OSGi 框架中,但它有一个要求,无法被安装的任何其他 bundle 满足。

Unresolved 需求在命名空间 osgi.wiring.package 中,这意味着这种需求是 Java 包导入,即您看到的 Import-Package 在你的包的 list 中。换句话说,您的包导入一个包,而没有其他包导出该包。

最后,(osgi.wiring.package=bundle) 是一个过滤器,它表达了您的包所需的确切包名。在这种情况下,您的包显然导入了一个名为“bundle”的包。

这有点奇怪,暗示您可能在构建包的方式上犯了错误。如果您发布有关如何构建此 bundle 的详细信息,将会有所帮助。

关于maven - 无法启动 bundle - 缺少要求(osgi.wiring.package),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47508152/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com