开发者

Using JACORB in OSGI

开发者 https://www.devze.com 2022-12-21 15:35 出处:网络
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-B开发者

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-B开发者_StackOverflowundle?

Thanks Moritz


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消