1

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.

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.

stefan.itu
  • 41
  • 5
  • Karaf is just Felix plus some bundles, therefore as Blueprint runs in Karaf, it will certainly run in Felix. Please post the details of what you tried to do and what the errors were. "It didn't seem to work" is not a very helpful statement. – Neil Bartlett Jul 24 '14 at 15:57
  • 1
    Thanks Neil. I've posted more info in the description. What you're saying there is the theory which I know as well and I agree with it. The problem comes when I try to put it in practice and to make an workable example. It doesn't work. I didn't find any workable example nor help about this. It looks like nobody tried to run a Blueprint bundle in Felix. I would like to know which bundles I have to add to Felix before in order to have Aries working in Felix in order to be able to run a Blueprint bundle. – stefan.itu Jul 24 '14 at 21:46
  • "Nobody tried to run a Blueprint bundle in Felix". No, lots of people do it every day. Perhaps the problem is they're not stopping to write tutorials about how it's done. Just install the `org.apache.aries.blueprint.extender` bundle along with its dependencies, and you are done. – Neil Bartlett Jul 28 '14 at 12:40

2 Answers2

2

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
  • 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)

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.

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>
stefan.itu
  • 41
  • 5
1

Aries should run very well on Apache Felix it does not require Apache Karaf to run. In fact we are using plain equinox for our integration tests.

You can take a look at the integration test base class to see which bundles you need.

Christian Schneider
  • 19,420
  • 2
  • 39
  • 64