• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Modular Java: servlet container

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can OSGi be replacement for servlet containers or this is rather misunderstanding?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While OSGi can be used to architect a web server or servlet container, there's nothing in it that handles HTTP, so, no, it's not a replacement for that.
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:While OSGi can be used to architect a web server or servlet container, there's nothing in it that handles HTTP, so, no, it's not a replacement for that.



Not exactly true. The core OSGi spec doesn't call for any HTTP handling, but the compendium to the spec does describe an HTTP service that can handle basic servlet requests (not much more than that, though). And you have to programmatically register servlets with the HTTP service (eg, no web.xml).

Building on top of the HTTP service is a project called Pax Web. It provides an implementation of OSGi's HTTP service that also supports JSP, servlet filters, listeners...pretty much everything you'd need. And, it includes an extender that makes it possible to deploy near-standard WAR files (with a tiny bit of extra goodness in the manifest) to OSGi.

Spring-DM also supports servlet-based web development, but in a different way. They lean heavily on either Tomcat or Jetty to do what they do best, but let you install WAR files as bundles in the OSGi framework. This is my current preferred approach, but I may change my mind as the OSGi R4.2 spec starts taking shape with web bundle support.
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about EJB support?
Is OpenEJB similar to Pax Web in a sense that OpenEJB supports OSGi?
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kengkaj Sathianpantarit wrote:What about EJB support?
Is OpenEJB similar to Pax Web in a sense that OpenEJB supports OSGi?



I'm not clear on what level of OSGi support OpenEJB offers. But, if it comes as one or more OSGi bundles that once installed in an OSGi runtime, it will install and serve .EAR files, then yes...OSGi supports EJB. But, again, I don't know enough about OpenEJB to know if that's anywhere near the truth.

The current implementations of the various web extenders (Spring-DM and Pax Web) demonstrate that it's possible to create OSGi bundles that can deploy traditional web artifacts to a web container embedded in the OSGi framework. If that's true, then I have a hard time believing that you couldn't do the same thing for EJB. Why not have an "ear extender" (sounds funny when you say it out loud) that watches for OSGi bundles that look a little like EAR files and, if it finds them, deploys them to an embedded EJB container. Sounds plausible. Is this what OpenEJB does? I don't know...but now you have me curious, so I'm going to find out.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From OSGi & OpenEJB, OpenEJB can be run as a bundle, and we can create EJB bundles.
I'm still not sure about EAR (WAR + EJB), but I guess it should work if we combine power of OpenEJB and a web extender like Pax Web together.
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kengkaj Sathianpantarit wrote:From OSGi & OpenEJB, OpenEJB can be run as a bundle, and we can create EJB bundles.
I'm still not sure about EAR (WAR + EJB), but I guess it should work if we combine power of OpenEJB and a web extender like Pax Web together.



I took a quick look at this and yes...it looks like OpenEJB will do the trick, allowing you to deploy EJBs in OSGi.

I think that their approach could be improved upon by employing an extender (so that the EJB bundle author doesn't have to provide a BundleActivator). But it's a good start.

FYI, the extender pattern is a common OSGi design pattern. Basically an extender is a bundle that watches for other bundles to be started and if those bundles are the kinds of bundles that the extender is interested in, then the extender can apply certain extra behavior to those bundles.

The common example is a web extender that watches for web bundles to be started and then installs them in an embedded web container. For OpenEJB, they could benefit from an EJB extender that watches for EJB bundles to be started and then installs them in an embedded OpenEJB container.
 
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic