在 OSGI 中使用 JACORB

发布于 2024-08-23 09:36:05 字数 110 浏览 7 评论 0原文

我正在尝试使用 OSGI-Bundle 中的 JACORB。我读到过一些人在启动和运行它时遇到了很多困难。你们中有人有将 JaCORB 纳入 OSGi-Bundle 的经验吗?

谢谢 莫里茨

I'm trying to use JACORB from am OSGI-Bundle. I read about people, who had a lot of trouble getting it up and running. Does anyone of you have any experience with including JaCORB into an OSGi-Bundle?

Thanks
Moritz

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

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

发布评论

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

评论(2

无敌元气妹 2024-08-30 09:36:05

CORBA 通常需要创建大量特定于类的代码,并且我怀疑 JACORB 是否会以类安全的方式从包中执行此操作(因为毫无疑问,它需要访问其他类才能实现)。

如果您确实需要这样做,那么

DynamicImport-Package: *

在捆绑包中添加:将使 JACORB 能够完全访问您的(导出的)捆绑包。请注意,这意味着当 JACORB 绑定到您的特定版本的包时,它不会是动态的(即,它将在您的包的生命周期内永久连接自己)。

您可能想研究一下 OSGi 远程服务;有许多不同的实现通过网络提供服务;例如, Eclipse ECFApache CXF

如果您只需要通过 OSGi 调用客户端,那么最好将 JACORB 的内部副本捆绑在您的捆绑包中(这样它将看到您的捆绑包看到的内容),然后设置捆绑包的类路径:

Bundle-ClassPath: .,jacorb.jar

这样,您的客户端将能够调用远程 CORBA 服务,但不能(轻松)传入请求。另请注意,可能存在许多单例资源(例如 IIOR 端口),这可能意味着您只能在每个 OSGi VM 上使用此技巧一次。

CORBA generally needs to create a lot of class-specific code, and I doubt that JACORB is going to do that in a class-safe way from a bundle (since it will no doubt need access to other classes to make it happen).

If you really need to do this, then adding a:

DynamicImport-Package: *

to the bundle will give the JACORB full access to your (exported) bundles. Note that what this means is that when JACORB becomes bound to your specific version of the package, it won't be dynamic (i.e. it will wire itself up permanently for the lifetime of your bundle).

You may want to look into OSGi remote services; there are a number of different implementations that provide services over the network; for example, Eclipse ECF or Apache CXF.

If you just need to call a client over OSGi, then it may be better to bundle an internal copy of JACORB in your bundle (so it will see what your bundle sees) and then set up the bundle's classpath with:

Bundle-ClassPath: .,jacorb.jar

That way, your client will be able to call out to a remote CORBA service, but not (easily) incoming requests. Note also that there may be a number of singleton resources (such as the IIOR port) which may mean you're limited to using this trick once per OSGi VM.

—━☆沉默づ 2024-08-30 09:36:05

您是否尝试过使用系统片段?我们通过将 Jacorb 放在捆绑包中和系统片段中来解决这个问题。这有点不正统,但确实有效。

  1. 创建一个包 (org.jacorb) 并包装所有现有的 jacorb jar。暴露包。
    这样您就可以在需要时评估 jacorb 课程。
  2. 创建一个片段,其中主机包是 system.host。也将所有 jacorb 罐子添加到此处。
    这样,当 JVM 创建 ORB 时,它可以成功找到通常不会出现在类路径中的 ORB 类,除非您依赖 jacorb 包。

瞧!现在,您的所有插件都不需要依赖于 jacorb,并且您可以像使用 Java 系统属性一样使用 jacorb。

Have you tried using a system fragment. We got around this problem by having Jacorb both in a bundle AND in a system fragment. It's a little unorthodox but it does work.

  1. Create a bundle (org.jacorb) and wrap all the existing jacorb jars. Expose the packages.
    This is so you can have assess to the jacorb classes if need be.
  2. Create a fragment where the host bundle is system.host. Add all the jacorb jars here as well.
    This is so when the JVM goes to create the ORB it can successfully find the ORB class which wouldn't normally be on your classpath unless you depended on the jacorb bundle.

Voila! Now all your plugins don't need dependencies on jacorb and you use jacorb like you always would with the Java System properties.

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