标签: apache-felix

从捆绑包部署捆绑包

我想从OSGI包中启动OSGI包.正如您所看到的,此代码通过从目录部署它来启动bundle:

private void installStartBundle(BundleContext bc, String location, String name) throws BundleException
        {
            debug("installing " + location + "...");
            Bundle[] all = bc.getBundles();
            for (Bundle bundle : all)
            {
                String l = bundle.getLocation();
                if (l.indexOf(name) != -1)
                {
                    debug("already installed bundle " + bundle.getBundleId() + "|" + bundle.getLocation() + ">" + bundle.getSymbolicName());
                    return;
                }
            }

            Bundle b = bc.installBundle(location);
            debug("starting " + b.getSymbolicName());
            b.start();
        }
Run Code Online (Sandbox Code Playgroud)

我注意到一个问题:例如,我有一个包含xml配置文件和主包的包,它通过将其部署到Felix并将包访问到xml包中来加载xml配置文件.

我可以从bundle成功安装bundle,但是依赖包的导出包不可访问.也许部署过程太慢,捆绑加载器无法找到导出的包.知道如何解决这个问题吗?

PS你能告诉我如何检查一个捆绑包是否在Felix中成功部署?

java osgi bundle apache-felix osgi-bundle

0
推荐指数
1
解决办法
150
查看次数

Apache Karaf和OSGI Bundles

在Google浏览器上搜索了很多,我知道它用于测试和构建OSGI包.我还没弄清楚如何处理Apache Karaf以及如何使用它我也不太了解OSGI包的需求.

此外,我也想知道以下疑虑的答案:

  1. 什么是简单的单词Apache karaf?
  2. 它解决了什么目的?它可以用于解决日常的算法问题吗?
  3. 我在哪里可以找到关于Karaf的好教程问题
  4. Apache Karaf,Apache Felix和Apache Maven有什么区别?它们与OSGI有什么关系?

osgi apache-felix apache-karaf osgi-bundle karaf

0
推荐指数
1
解决办法
2409
查看次数

OSGI与Apache Felix

我必须为学校创建一个项目.我们想要创建一个监控传感器的系统.由于传感器发展很快,他们有可能在几年内使用其他传感器.要捕获该问题,我们希望创建一个允许用户编写插件来监控传感器的系统.

我正在寻找不同的框架,主要是OSGI.

有人能告诉我Apache Felix和OSGI之间的区别吗?OSGI还活跃吗?

谢谢!

java osgi modularity apache-felix

0
推荐指数
1
解决办法
747
查看次数

felix maven-bundle-plugin 错误 (&(osgi.wiring.package=com.abc)(version>=xx.0.0)(!(version>=yy.0.0)

我使用Apache Felix来实现osgi包并将其用作嵌入式Felix框架来调用boundle

这是我的 Maven 插件来构建 MANIFEST.MF :

<plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>3.5.0</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                    <Bundle-Activator>a.b.c.osgi.activator.Activator</Bundle-Activator>
                </instructions>
            </configuration>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

我构建项目,然后在嵌入的 felix 中使用 jar 文件,如下所示

BundleContext bundleContext = f.getBundleContext();
    Bundle bundle = bundleContext.installBundle(
            "file:/home/eclipse_workSpace/my-module/target/abc-1.1.0.jar");)

    String bName = bundle.getLocation();
    bundle.getRegisteredServices();
    bundle.getState();

    /* Bundle[] bls = bundleContext.getBundles(); */

    System.out.println("starting bundle " + bName);
    bundle.start();
Run Code Online (Sandbox Code Playgroud)

当我开始 Boundle 时,我遇到了这个异常

线程“main”中的异常 org.osgi.framework.BundleException:无法解析 abc [1](R 1.0):缺少要求 [abc [1](R 1.0)] osgi.wiring.package;(&(osgi.wiring.package=com.google.common.base)(version>=21.0.0)(!(version>=22.0.0))) 未解决的要求:[[abc [1](R 1.0) ] osgi.wiring.package;(&(osgi.wiring.package=com.google.common.base)(版本>=21.0.0)(!(版本>=22.0.0)))]

我应该怎么做才能解决这个问题?

osgi apache-felix maven-bundle-plugin

0
推荐指数
1
解决办法
831
查看次数