PDA

View Full Version : osgi + spring dm + jboss


lina
May 15th, 2008, 04:00 PM
Is it possible to use osgi for web application that runs with jboss application server?

oleg.zhurakousky
May 15th, 2008, 09:17 PM
Well. . . "is it possible. . .?" Yes, it is possible. You have to OSGi-fy all bundles JBoss depends on. Given JBoss architecture, the real question should be: Could you OSGi-fy JBoss Microcontainer, because everything else is a Service (SAR) that sits on top of it. Also, such architecture implies conflicting concerns with OSGi, where JBoss Microcontainer plays a similar role to OSGi platform, where every bundle could be looked at as service and the types of deployed bundles defines the capability of the entire platform (similar to JBoss's all. default and minimal configuration). Putting other factors aside: JBoss defines services deployed into its proprietary platform (JBoss Microcontainer) while Spring DM uses standardized platform (OSGi).

So, (please don't take it the wrong way) since JBoss is a platform, what would be the reason to deploy one "platform" on top of another "platform"?

alesj
May 16th, 2008, 05:20 AM
To correct a few mistakes. ;-)

because everything else is a Service (SAR) that sits on top of it.

Everything else is a normal JAR, with a simple services/pojos -beans.xml file descriptors.

Putting other factors aside: JBoss defines services deployed into its proprietary platform (JBoss Microcontainer) while Spring DM uses standardized platform (OSGi).

What is proprietary about MC's lookup?
It's all POJOs, user should need no knowledge about MC internals.

It's exactly the same as with Spring DM, it's just that underlying framework differs, which should almost always be transparent anyway - if you take pride in your pojos. ;-)
And no, Spring DM is not a standard way of deploying OSGi services. ;-)
That's not DSS from OSGi spec, and #2 is not out yet. ;-)

btw: it's a web app - aka standard deployment - so why would this require JBoss MC?
Isn't this what S2AP is supposed to do, OSGi-ize wars?

Costin Leau
May 16th, 2008, 06:15 AM
Spring-DM currently requires the web container to be published as an OSGi service so if that's done then yes, it would be possible to use osgi and spring-dm inside any container including JBoss.
You'll probably have to embed the OSGi platform as a library and then deploy it as a WAR/EAR or whatever format the container supports (such as a SAR in this case).

Costin Leau
May 16th, 2008, 06:19 AM
And no, Spring DM is not a standard way of deploying OSGi services. ;-)

You misinterpreted Oleg's words:
..Spring DM uses standardized platform (OSGi).
Spring-DM is not a standard (for the time being at least) but OSGi is and this is what Spring-DM uses to export and import services.
One can use Spring-DM to export services inside the OSGi service registry and then use the OSGi api to import it and vice-versa.

oleg.zhurakousky
May 16th, 2008, 07:33 AM
Everything else is a normal JAR, with a simple services/pojos -beans.xml file descriptors.
JBoss MC is just a platform for hosting services such as Tomcat or JBossWeb (4.3), Deployers (EJB, WAR etc). So without it is as we all seem to agree it is just another platform for hosting components.

btw: it's a web app - aka standard deployment - so why would this require JBoss MC?

Because JBossMC is a platform that hosts your Tomcat or JBossWeb as well as many other services that make up JEE container. Look ate the minimal vs default configuration. The later one is J2EE container while the minimal is nothing more then raw MC without capabilities of hosting anything other then JARs and SARs and -beans in later version.

So the real question, as I suspected, is if Spring DM is capable of dealing with Web Application. The answer is yes, however just like in JBoss where you need to deploy Tomcat Service (JBoss-web in later version) in OSGi you need to deploy bundles representing your Web container (as Costin mentioned). The great part is that you have a choice of web container. Currently Spring DM supports Tomcat and Jetty: http://static.springframework.org/osgi/docs/current/reference/html/web.html
So if you only require capabilities of web container, then you don't need JBoss MC you only need Servlet container which is deployed as OSGi bundle.

lina
May 16th, 2008, 10:37 AM
Thank you for the replies. Is there any step-by-step tutorial that I can follow in how to create an osgi web application and deploy it in application server such as jboss?

oleg.zhurakousky
May 16th, 2008, 11:06 AM
I am working on tutorial on how to create OSGi-fied Web application and deploy them in Spring-DM/Equinox environment which will use Tomcat and/or Jetty. I should be publishing it some time overthe weekend (i'll post a follow up reply as to where it is).
As far as JBoss I want to reiterate once again. JBoss by itself is not a web container. It is a platform that hosts web container as a service (along with other services and in that sence it is simmilar to OSGi model). Depending on the version of JBoss you are using it uses Tomcat or JBoss-web (based on Tomcat). So if you are talking about simple non-EJB based web application then regardless weather you are using JBoss as platform or OSGi as platform such as Equinox, these platforms both use Tomcat. However OSGi can use any other servlet container if it is OSGo-fied.

alesj
May 17th, 2008, 04:59 AM
However OSGi can use any other servlet container if it is OSGo-fied.
And JBoss can't?
"However JBoss can use any other servlet container if it is JBoss-ified".
or even better:
"However JBoss can use any other servlet container if it can be run as a standalone service".
;)