Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Embed Eclipse Virgo inside another application server
Embed Eclipse Virgo inside another application server [message #834884] Mon, 02 April 2012 10:19 Go to next message
Paul Duffin is currently offline Paul Duffin
Messages: 9
Registered: July 2009
Junior Member
This may seem like a weird thing to want to do but I do have a good reason for it, honest.

The product for which I am responsible can be installed on a number of different application servers, e.g. JBoss, Tomcat, WebLogic, WebSphere. The choice is usually made by our customers. However, I want to make use of OSGi within the product to avoid us having to create our own inferior solution to the problems that OSGi already addresses. e.g. We have a need for dynamically loading various types of 'bundle' just like VTS supports.

For internal use we should be able to use Eclipse Virgo (i.e. VTS) out of the box but we cannot force our customers to change their preferred application server. However, we can define the structure inside the application.

One of our products already embeds OSGi using a proprietary 'bridge' that we created long before Enterprise OSGi came along and that works reasonably well, e.g. it routes all requests to the application through to our own implementation of the HttpService. However, we want to stop maintaining that ourselves and move towards something more 'standard'. But we are quite happy to write any bridging code between the application and the embedded Eclipse Virgo but do not know where to start.

I have a suspicion that this question is probably more related to Embedded Tomcat/Jetty than Eclipse Virgo but given that Eclipse Virgo can support both Tomcat and Jetty I thought that I would ask here first. I have had a look at both Embedded Tomcat and Jetty but there does not seem anyway to stop them from creating the incoming socket. Whereas what I want them to do is behave more like a Servlet, e.g. be given the HttpServletRequest/Response pair.

Just in case there is another way I can get what I need here is a brief summary of what the product does and what we are trying to achieve.

Our product essentially provides a Servlet Filter that processes incoming requests and outgoing responses. All requests to our application that satisfy the filter mapping, including those handled by the embedded Eclipse Virgo need to pass through the filter.

Within the application we need to support:
* Hot deployment, and removal of WAR files within the application, i.e. 'sub-context'. Would behave just like deploying WAR file in stand alone tomcat, i.e. create filters, servlets, contain custom JAR files.
* Hot deployment and removal of various types of OSGi bundles to be shared and used by the deployed WAR files.

Any help or advice would be greatly appreciated.
Re: Embed Eclipse Virgo inside another application server [message #834903 is a reply to message #834884] Mon, 02 April 2012 10:38 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Apparently some people use embedded Jetty for this kind of use case. I gather it is possible to deploy OSGi standard Web Application Bundles into the embedded Jetty and drive them via a servlet request in the containing app server. Unfortunately, I don't know the technical details, so I recommend posting in Jetty land.

However, if you can figure out an approach which builds on Equinox, then it should be fairly straightforward to substituted Virgo nano, or possibly even the Virgo kernel, for Equinox and get Virgo's hot deployment support and other goodies such as nice diagnostics, medic/logback, Gogo shell, etc. (We are drawing up a feature comparison of the various Virgo deliverables, so keep an eye on the Virgo home page later this week. Or check out the Virgo white paper, available from the Virgo home page, which has a section entitled "Virgo Runtime Deliverables".)
Re: Embed Eclipse Virgo inside another application server [message #834917 is a reply to message #834884] Mon, 02 April 2012 10:51 Go to previous messageGo to next message
Frieder Heugel is currently offline Frieder Heugel
Messages: 61
Registered: October 2010
Location: Basel, CH
Member
Hi

I may be wrong but I think it is not possible to integrate Virgo with any existing app server (at least not without some serious effort). The same should be valid for Apache Karaf. Please correct me if I'm wrong.

What you are probably looking for is called a servlet bridge. That is the only standard way I know of how to integrate an OSGi container in app servers/servlet containers. Most apps I know (which aren't many to be honest) are using Apache Felix for this even though Equinox works well too. You could start by taking a look on the Felix example sources. There you can find an (slightly outdated) example of such a bridge implementation. I'm not quite sure if it is possible to deploy war files to ExtHTTPService but I would definitely be interested to learn more about that if someone can provide more information.

Frieder

[Updated on: Mon, 02 April 2012 10:55]

Report message to a moderator

Re: Embed Eclipse Virgo inside another application server [message #834921 is a reply to message #834917] Mon, 02 April 2012 10:57 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Here are a couple of links about servlet bridge which may help:

http://eclipse.dzone.com/articles/embedding-osgi-tomcat

http://people.scs.carleton.ca/~deugo/thesis/simon-kaegi/thesis-sk-final.pdf

Note that servlet bridge doesn't support the driving of OSGi standard Web Application Bundles and is a rather different solution to the embedded Jetty approach I mentioned above.

[Updated on: Mon, 02 April 2012 10:58]

Report message to a moderator

Re: Embed Eclipse Virgo inside another application server [message #834934 is a reply to message #834903] Mon, 02 April 2012 11:16 Go to previous messageGo to next message
Frieder Heugel is currently offline Frieder Heugel
Messages: 61
Registered: October 2010
Location: Basel, CH
Member
Glyn Normington wrote on Mon, 02 April 2012 16:38
Apparently some people use embedded Jetty for this kind of use case. I gather it is possible to deploy OSGi standard Web Application Bundles into the embedded Jetty and drive them via a servlet request in the containing app server.


That sounds interesting, thx for the hint.
Re: Embed Eclipse Virgo inside another application server [message #834940 is a reply to message #834934] Mon, 02 April 2012 11:28 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
If anyone reading this thread figures out how to run "embedded Jetty" in the way I mentioned, I think it would be a really useful exercise to write up how to use Virgo Nano plus the relevant Jetty bundles to support this usecase. We could even consider an extra Virgo deliverable to produce this in a pre-packaged form as I'm sure it would appeal to a lot of potential users who are stuck with an existing app server.

So may I encourage everyone to write up their experiments, if only briefly, so we can learn from each other's experiences.
Re: Embed Eclipse Virgo inside another application server [message #835646 is a reply to message #834940] Tue, 03 April 2012 09:55 Go to previous messageGo to next message
Hugues Malphettes is currently offline Hugues Malphettes
Messages: 21
Registered: July 2009
Junior Member
Hi there,

As Glyn mentioned, Jetty supports an extended servlet-bridge. It is called the "jetty-nested" connector.
Here is a short presentation of this feature: webtide.intalio.com/2011/04/jetty-7-4-new-features
We have been using at Intalio to run jetty-osgi on cloudfoundry.com's tomcat.

For the sake of an overview of what we are doing with jetty-osgi to use the bridge, here are the steps:
- Build this webapp: git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-osgi/jetty-osgi-servletbridge
- Make a p2 roaming install inside the WEB-INF folder of this app.
- Jetty-osgi detects that it is nested and uses by default this config file where you can see the jetty-nested connector: git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-osgi/jetty-osgi-boot/jettyhome/etc/jetty-osgi-nested-default.xml#n15

I think this would solve the problem and I would like to be able to use this with Virgo rather than jetty-OSGi.
Can you guys confirm this would suit your needs?

Cheers,
Hugues
Re: Embed Eclipse Virgo inside another application server [message #836353 is a reply to message #835646] Wed, 04 April 2012 07:38 Go to previous messageGo to next message
Frieder Heugel is currently offline Frieder Heugel
Messages: 61
Registered: October 2010
Location: Basel, CH
Member
Hi Hugues

Thank you for the information. This sounds quite interesting. It would be great if Virgo would be available in such an environment. I'll try to find some spare time to give this a try.

Frieder
Re: Embed Eclipse Virgo inside another application server [message #836547 is a reply to message #836353] Wed, 04 April 2012 12:06 Go to previous messageGo to next message
Paul Duffin is currently offline Paul Duffin
Messages: 9
Registered: July 2009
Junior Member
Thanks for all the replies, it is nice to know that I am not alone!! The information about Jetty seems like the last piece in the puzzle, just need to try and fit them all together!!
Re: Embed Eclipse Virgo inside another application server [message #836579 is a reply to message #836547] Wed, 04 April 2012 12:53 Go to previous message
Paul Duffin is currently offline Paul Duffin
Messages: 9
Registered: July 2009
Junior Member
Hi Hugues,

You mentioned "Jetty-osgi detects that it is nested", how does it do that?
Previous Topic:CME Group Experience of Virgo
Next Topic:Empty bundle dependecies after upgrading VTS to 3.5.0.M2
Goto Forum:
  


Current Time: Mon Jul 28 00:35:03 EDT 2014

Powered by FUDForum. Page generated in 0.02563 seconds