如何让 Spring Dynamic Modules 2.x 在 Apache Felix Karaf 上工作?

发布于 2024-09-27 11:08:34 字数 1048 浏览 3 评论 0原文

我们开始在一个项目中使用 Apache Felix Karaf,并利用 Blueprint Services。

现在,我想使用 Spring 动态模块来访问高级 DI 功能和测试功能。问题是我一直无法弄清楚如何让 Spring DM 2.x 在 Felix 上运行。

spring 和 spring-dm 功能已安装:

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

但是为了使用 Blueprint 服务,我需要 Spring DM 2.x(至少根据 Spring 网站,“对于 Blueprint Service RI,请使用 2.x+ 版本。”) 。

我发现可以向 Apache Felix 添加功能,但从我的情况来看可以理解,这需要在某个存储库上声明一个 features.xml 文件。

我的问题是,是否有更简单的方法,也更集成(例如通过 Maven)

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

四叶草在未来唯美盛开 2024-10-04 11:08:34

好的,经过一番调查,我成功地让这些包与 Karaf 上的 Spring DM 2.0.0.M1 一起使用。

我解决这个问题的方法是添加额外的功能集(请参阅 http ://karaf.apache.org/manual/2.2.5/users-guide/provisioning.html)通过定义一个功能 xml 描述符,如下所示:

<?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>

加载它

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

然后通过 Karaf shell 像这样 可以工作,但是带有一些丑陋的堆栈跟踪——我希望在 Karaf 用户列表上的人/Spring 人员的帮助下,我们能够摆脱这些。

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/manual/2.2.5/users-guide/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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文