views:

33

answers:

1

We started using Apache Felix Karaf for a project, and make use of Blueprint Services.

Now, I would like to use Spring Dynamic Modules in order to have access to advanced DI functionality and testing features. The problem is that I haven't been able to figure out how to get Spring DM 2.x running on Felix.

The spring and spring-dm features are installed:

karaf@root> features:list
State         Version       Name       Repository
[installed  ] [2.5.6.SEC01] spring     karaf-1.6.0
[installed  ] [1.2.0      ] spring-dm  karaf-1.6.0
[uninstalled] [1.6.0      ] wrapper    karaf-1.6.0
[uninstalled] [1.6.0      ] obr        karaf-1.6.0
[installed  ] [1.6.0      ] http       karaf-1.6.0
[uninstalled] [1.6.0      ] war        karaf-1.6.0
[uninstalled] [1.6.0      ] webconsole karaf-1.6.0
[installed  ] [1.6.0      ] ssh        karaf-1.6.0
[installed  ] [1.6.0      ] management karaf-1.6.0

But in order to use Blueprint services, I need Spring DM 2.x (according to the Spring website at least, 'For Blueprint Service RI, use the 2.x+version.').

I saw that it is possible to add features to Apache Felix, but from what I understood, this requires to declare a features.xml file on some repository.

My question is, whether there is a simpler way to go, which would also be more integrated (via e.g. Maven)

A: 

Ok, after some investigation I have managed to get the bundles to work with Spring DM 2.0.0.M1 on Karaf.

The way I solved it is to add an additional feature set (see http://karaf.apache.org/46-provisioning.html) by defining a feature xml descriptor like this:

<?xml version="1.0" encoding="UTF-8"?>
  <features name="spring-features">
    <feature name="spring-dm-2" version="2.0.0.M1">
        <feature version="3.0.3.RELEASE">spring</feature>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.cglib/2.1_3_6</bundle>
        <bundle>mvn:org.springframework.osgi/spring-osgi-io/2.0.0.M1</bundle>
        <bundle>mvn:org.springframework.osgi/spring-osgi-core/2.0.0.M1</bundle>
        <bundle>mvn:org.springframework.osgi/spring-osgi-extender/2.0.0.M1</bundle>
        <bundle>mvn:org.springframework.osgi/spring-osgi-annotation/2.0.0.M1</bundle>
        <bundle>mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.spring/2.1.0</bundle>
    </feature>
  </features>

And then to load it like this via the Karaf shell

features:addurl /path/to/spring-dm-feature.xml
features:install spring-dm-2

Note that this works, but comes with a number of ugly stacktraces -- I hope that with the help of the guys on the Karaf users list / the Spring folks we'll be able to get rid of those.

Manuel