首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在Apache ServiceMix中启动OSGI包

无法在Apache ServiceMix中启动OSGI包
EN

Stack Overflow用户
提问于 2017-11-04 19:20:19
回答 1查看 363关注 0票数 0

我想要创建OSGI包。我创造了一个简单的课程:

代码语言:javascript
复制
public class Activator implements BundleActivator {
public void start(BundleContext bundleContext) throws Exception {
    System.out.println("::::START MAIL BUNDLE::::");
}

public void stop(BundleContext bundleContext) throws Exception {
    System.out.println("::::STOP MAIL BUNDLE::::");
}
}

我的pom.xml

代码语言:javascript
复制
<dependencies>
    <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.core</artifactId>
        <version>6.0.0</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <inherited>true</inherited>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <executions>
                <execution>
                    <id>osgi-bundle</id>
                    <goals>
                        <goal>bundle</goal>
                    </goals>
                    <phase>package</phase>
                    <configuration>
                        <instructions>
                            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                            <Bundle-Version>${project.version}</Bundle-Version>
                            <Import-Package>
                                *;resolution:=optional
                            </Import-Package>
                        </instructions>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我使用Service Mix。我将org.osgi.core-6.0.0.jar和jar添加到目标文件夹中。我的包是活动的,但是在karaf控制台中启动/停止包时,我没有看到我的消息。我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-11-04 19:42:09

您必须在maven-bundle-config中设置<Bundle-Activator>your.package.name.Activator</Bundle-Activator>。还请注意,永远不要部署org.osgi.core或org.osgi.componendium。核心包由OSGi框架部署,概要由单个规范执行。

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

https://stackoverflow.com/questions/47114656

复制
相关文章

相似问题

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