Apache Aries是否在Felix中运行? [英] Is Apache Aries running in Felix?

查看:113
本文介绍了Apache Aries是否在Felix中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个可在Apache Felix中运行的Blueprint捆绑包.我试图使其运行,但没有成功. 蓝图包在Karaf中可以正常工作,但在Felix中则不能.是Web上的任何文档或正在运行的示例,以解释如何仅使用普通Felix来运行Blueprint捆绑包.我想我必须手动将Aries添加到Felix平台上,但是似乎没有用.

I'm trying to build a Blueprint bundle to run in Apache Felix. I tried to make it running but I didn't succeed. The blueprint bundle works fine in Karaf but not in Felix. Is it any documentation or a running example on the web to explain how to run a Blueprint bundle only with plain Felix. I suppose I have to manually add Aries to Felix platform but it didn't seem to work.

更准确地说,我想要一个简单的服务,以查看它是作为blueprint捆绑包从blueprint.xml XML配置文件加载的.该服务可能只有一个虚拟方法,甚至可能只有一个带有println的构造函数.我想在OSGI-INF/blueprint/blueprint.xml中引用该服务类,以便在Felix加载Blueprint捆绑包时将其加载.

To be more precise, I want a simple service to see that it's loaded from a blueprint.xml XML config file as a Blueprint bundle. The service may have only one dummy method or even just a constructor with a println in it. That service class I want to refer it in OSGI-INF/blueprint/blueprint.xml so it will be loaded when the Blueprint bundle is loaded by Felix.

推荐答案

花了一些时间尝试解决此问题后,我找到了解决方案.因此,您需要将以下捆绑软件安装到Felix(已通过v.4.4.1测试)中,以使Aries Blueprint运行:

After spending some time trying to solve this problem I found the solution. So, you need the following bundles to be installed into your Felix (tested with v.4.4.1) in order to make Aries Blueprint running:

  • org.apache.aries.blueprint:org.apache.aries.blueprint:1.1.0
  • org.apache.aries:org.apache.aries.util:1.1.0
  • org.apache.aries.proxy:org.apache.aries.proxy:1.0.1
  • org.apache.felix:org.apache.felix.configadmin:1.8.0
  • SLI4J的一个实现(在本例中为PAX日志记录):
    • org.ops4j.pax.logging:pax-logging-api:1.4
    • org.ops4j.pax.logging:pax-logging-service:1.4 (由于不需要,您可以排除log4j:log4j)
    • org.apache.aries.blueprint : org.apache.aries.blueprint : 1.1.0
    • org.apache.aries : org.apache.aries.util : 1.1.0
    • org.apache.aries.proxy : org.apache.aries.proxy : 1.0.1
    • org.apache.felix : org.apache.felix.configadmin : 1.8.0
    • one implementation of SLF4J (in this case will be PAX Logging):
      • org.ops4j.pax.logging : pax-logging-api : 1.4
      • org.ops4j.pax.logging : pax-logging-service : 1.4 (you may exclude log4j : log4j because is not needed)

      这些jar将启用Felix中的Aries Blueprint(但仅XML配置版本).如果要使用批注,则还必须添加与批注相关的Jars.

      These jars will enable Aries Blueprint in Felix (but only the XML configuration version). If you want to use annotations, you have to add also annotation related Jars.

      这是减轻您工作负担的pom.只需运行它,所有需要在felix中安装的jar都将位于目标文件夹中.

      Here is a pom to ease your work. Just run it and all the jar needed to be installed in felix will be in your target folder.

      <?xml version="1.0" encoding="UTF-8"?>
      <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>org.apache.aries</groupId>
          <artifactId>blueprint-felix-assembly</artifactId>
          <version>1.0-SNAPSHOT</version>
          <name>Blueprint Felix Jar Assembly</name>
          <packaging>pom</packaging>
          <properties>
              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
              <pax.logging.version>1.4</pax.logging.version>
              <aries.version>1.1.0</aries.version>
              <aries.proxy.version>1.0.1</aries.proxy.version>
              <felix.config.admin.version>1.8.0</felix.config.admin.version>
          </properties>
          <dependencies>
              <dependency>
                  <groupId>org.apache.felix</groupId>
                  <artifactId>org.apache.felix.configadmin</artifactId>
                  <version>${felix.config.admin.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.logging</groupId>
                  <artifactId>pax-logging-api</artifactId>
                  <version>${pax.logging.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.ops4j.pax.logging</groupId>
                  <artifactId>pax-logging-service</artifactId>
                  <version>${pax.logging.version}</version>
                  <exclusions>
                      <exclusion>
                          <groupId>log4j</groupId>
                          <artifactId>log4j</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>
              <dependency>
                  <groupId>org.apache.aries.blueprint</groupId>
                  <artifactId>org.apache.aries.blueprint</artifactId>
                  <version>${aries.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.apache.aries</groupId>
                  <artifactId>org.apache.aries.util</artifactId>
                  <version>${aries.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.apache.aries.proxy</groupId>
                  <artifactId>org.apache.aries.proxy</artifactId>
                  <version>${aries.proxy.version}</version>
              </dependency>
          </dependencies>
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-dependency-plugin</artifactId>
                      <executions>
                          <execution>
                              <id>copy</id>
                              <phase>package</phase>
                              <goals>
                                  <goal>copy-dependencies</goal>
                              </goals>
                              <configuration>
                                  <excludeTransitive>true</excludeTransitive>
                                  <outputDirectory>${project.build.directory}</outputDirectory>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
      </project>
      

      这篇关于Apache Aries是否在Felix中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆