在 OSGI 中使用 JACORB
我正在尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CORBA 通常需要创建大量特定于类的代码,并且我怀疑 JACORB 是否会以类安全的方式从包中执行此操作(因为毫无疑问,它需要访问其他类才能实现)。
如果您确实需要这样做,那么
在捆绑包中添加:将使 JACORB 能够完全访问您的(导出的)捆绑包。请注意,这意味着当 JACORB 绑定到您的特定版本的包时,它不会是动态的(即,它将在您的包的生命周期内永久连接自己)。
您可能想研究一下 OSGi 远程服务;有许多不同的实现通过网络提供服务;例如, Eclipse ECF 或 Apache CXF。
如果您只需要通过 OSGi 调用客户端,那么最好将 JACORB 的内部副本捆绑在您的捆绑包中(这样它将看到您的捆绑包看到的内容),然后设置捆绑包的类路径:
这样,您的客户端将能够调用远程 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:
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:
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.
您是否尝试过使用系统片段?我们通过将 Jacorb 放在捆绑包中和系统片段中来解决这个问题。这有点不正统,但确实有效。
这样您就可以在需要时评估 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.
This is so you can have assess to the jacorb classes if need be.
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.