首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解决112.0:缺少需求[112.0] osgi.wiring.package;osgi.wiring.package

无法解决112.0:缺少需求[112.0] osgi.wiring.package;osgi.wiring.package
EN

Stack Overflow用户
提问于 2015-03-23 14:29:00
回答 1查看 1.5K关注 0票数 0

我正在apache 3.0.3中创建一个简单的Echo服务包,我有我的Activator类,

代码语言:javascript
复制
package com.company.activator;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

    private static BundleContext context;

    static BundleContext getContext() {
        return context;
    }

    /*
     * (non-Javadoc)
     *
     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
     */
    public void start(final BundleContext bundleContext) throws Exception {
        Activator.context = bundleContext;
    }

    /*
     * (non-Javadoc)
     *
     * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
     */
    public void stop(final BundleContext bundleContext) throws Exception {
        Activator.context = null;
    }

我可以使用下面的Mannifest文件通过eclipse创建Bundle

代码语言:javascript
复制
Manifest-Version: 1.0
Private-Package: com.company.activator
Built-By: noushad
Tool: Bnd-0.0.238
Bundle-Name: osgi
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.7.0_76
Bundle-Version: 1.0.0
Bnd-LastModified: 1427119505629
Bundle-ManifestVersion: 2
Bundle-Activator: com.company.activator.Activator
Export-Packages: com.company.echo
Bundle-SymbolicName: com.company.osgi
Import-Package: org.osgi.framework;version="1.8"

另外,我有以下POM文件

代码语言:javascript
复制
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.company</groupId>
    <artifactId>osgi</artifactId>
    <packaging>bundle</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>osgi Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.core</artifactId>
        <version>6.0.0</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>osgi</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>1.4.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
                        <Bundle-Version>1.0.0</Bundle-Version>
                        <Private-Package>com.company.activator</Private-Package>
                        <Bundle-Activator>com.company.activator.Activator</Bundle-Activator>
                        <Export-Packages>com.company.echo</Export-Packages>
                        <Import-Package>*</Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

还有我的回声课

代码语言:javascript
复制
package com.company.echo;

public class Echo {

    public String echo(final String string) {
        return string;
    }
}

在karaf 3.0.3上部署此应用程序时,我将面临以下问题

  1. 当我尝试启动包时,获取以下堆栈跟踪 错误:包com.company.osgi 112启动/停止包错误。( (&(osgi.wiring.package=org.osgi.framework)(version>=1.8.0))) org.osgi.framework.BundleException: osgi.wiring.package中未解决的约束:无法解决112.0:缺少需求112.0 osgi.wiring.package;(&(osgi.wiring.package=org.osgi.framework)(version>=1.8.0)) at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974) at org.apache.felix.framework.Felix.startBundle(Felix.java:2037) at org.apache.felix.framework.Felix.setBundleStartLevel(Felix.java:1483) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:334) at java.lang.Thread.run(Thread.java:745)

有人能帮我弄清楚到底是什么问题吗。

提前谢谢..!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-23 16:25:00

我不认为karaf 3支持OSGi Core R6 (org.osgi.framework包版本1.8)。您应该尝试针对另一个版本的OSGi API进行编译。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29212834

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档