1 of 1 people found this helpful
I'm not an expert on RESTeasy, but I think the RESTeasy libraries are distributed as JBoss Modules libraries, correct? I.e. in the modules/ directory of AS7.
You can load these modules into AS7/OSGi by adding them to the <modules> tag in standalone.xml, similar to this:
for more info see: http://docs.jboss.org/author/display/AS7/OSGi+subsystem+configuration
Restart AS7 and the modules should appear in the OSGi Framework as bundles and export their packages...
Hope this helps,
Thank you, but I think the users need a step by step guide with an example.
I am using Eclipse Indigo. I think I have to put in the manifest.mf an import for org.jboss.resteasy but it tells me that package has not been exported.
So I have 2 problems: how to configure JBoss 7 in order to enable OSGi bundles and how to configure eclipse in order it can see the JBoss exported bundles.
I think the OSGi support is still difficult to use !
I tried to enable all what I could enable for resteasy, but I get
Really, JBoss 7 needs more documentation for OSGi.
Comprehensive coverage of AS7 / OSGi integration in user guide is subject of JBOSGI-489.
Please monitor that issue on progress there.
A main objective of using OSGi bundles is to provide a portable component that can be deployed to a variety of OSGi runtimes. By relying on package exports that are somehow provided by AS7 to the OSGi layer, but would otherwise not be available in other OSGi runtimes you break that fundamental principal.
It seems you do not have an OSGi / AS7 integration use case. I suggest you start with a bundle that imports the required packages from itself (i.e. you put the jax-rs libraries on the Bundle-ClassPath). When that works, you can optimize by importing the required packages from another bundle.
As you might know, the JAX-RS client side is not covered by the spec. This is a propriatary feature of resteasy. You could wrap the resteasy client jar in a bundle and have the required packages exported from there. Take a look at the bnd documentation on jar wrapping.
In AS7 (as David mentioned) you also have the ability to register any AS7 module with the OSGi layer. Doing so you would however leave the boundaries of standards. This feature is provided for JavaEE / OSGi integration and not because we want to make any package from any jar available to OSGi - this would fundamentatlly be wrong and defeat to purpose of using OSGi bundles in the first place. So please think "modularity" and decide in terms of components what packages should be provided by whom, how the package export/import constraints are defined etc.
To get more familiar with OSGi you could also start with the OSGi Runtime that we provide as part of the JBoss OSGi distribution. When your REST client works in that pure OSGi environment it should also work in AS7. The documentation you ask for applies when you have a need for JavaEE component integration.
If JBoss has a library so advertised, such as RESTeasy, I think it make sense I can use it in OSGi without having to make a package by myself, downloading something that in JBoss aready exists ! Than I have to look for the updates of the application server and for the separate RESTeasy.
My task IS NOT to have a pure standard bundle, that I can install on Felix, Equinox and even JBoss, my task is to create a couple of bundles for something that is not easy with pure Java Enterprise, while I need Java EE for other things. That's way JBoss 7 seemed a good choice.
I was wrong because RESTeasy with OSGi is poorly documented and I spent 3 days of work trying to have RESTeasy work in OSGi.
I even tried to make a bundle from the RESTeasy jars, but it seems that internally it uses com.sun.ws.rs.ext.RuntimeDelegateImpl and I don't know how to provide it, because Jersey has A LOT of external dependencies.
Excuse me Thomas, but don't you think I think in modules, when I want to import just the RESTeasy packages? The problem is that I don't know how to make a provider that exports those packages.
I know the REST client is not the specification, I did not write the specs... I accept my bundle is going to use a "proprietary" api, but I trust JBoss, so it is not a big deal for me.
If I find no other solution, I think I will migrate to another technology, because I cannot efford to spend more days on this trouble.
I think it make sense I can use it in OSGi without having to make a package by myself
Does it? So any arbitrary package from any arbitrary jar that happens to be in the AS distribution should be accessable from OSGi? Basic principals of defined package exports and imports that guarantee class space consistency would be violated.
The way we can go about this is to file a feature request for JAX-RS client support for OSGi bundles. We can then assign it to a specific release and start progress on it. I'll discuss with the team how we can go about it - it seems a general/relevant enough request.
Yes, it does make sense.
I never wrote that "any arbitrary package from any arbitrary jar that happens to be in the AS distribution should be accessable from OSGi". I asked about RESTeasy ! It is something bigger than a simple .jar, in my humble opinion.
I saw some modules already exists, but I do not know how to use them, so it seems to me that using RESTeasy in OSGi was something the Jboss team thought about already and it is logical.
With the actual support of remote ejb interface and the soap ws, the RESTeasy seems to me a very good thing. At this point, using it in OSGi would be logic as OSGi is sometimes very useful.
Thank you for your support.
i founded also that resteasy doesn't support being used by OSGI client out-of-box. For me simplest soution now is to add all easyrest jars to my platform.rest bundle (add jars from lib/* to Manifest) and next export required packages (mostly annotations).