Spring Web Service accessing Osgi bundles deployed in Tomcat - spring

I have been tasked with looking at redesigning our current web service.
As a lot of the development of our main/legacy products was done using OSGi, we currently have a web service which is developed using osgi bundles and deployed using Talend.
Some of our newer products are being developed around Spring/Maven/Tomcat so I have been asked to investigate moving our web service to this technology stack.
What is required is a Spring contract first Web Service which can access the main business code, which will still be in its OSGi bundles, all packaged neatly in a war
to be deployed in Tomcat.
Is this possible?
Most pages I have seen seem to be pointing at using Virgo but our hope was to cut down on the technologies used, not to add others

Related

Migrate OSGI application from Karaf 2.3.4 to Websphere Application server

I have an OSGI application deployed in Karaf v2.3.4, it worked well, but I want to migrate it to WebSphere application server, I want to know the difference between these two servers, and the guidlines for doing that
thanks for your help
I've lead the development of OSGi applications on WebSphere, but am less familiar with Karaf. From what I can tell, we share the same Blueprint implementation. I believe that Karaf supports the OSGi application (.eba) packaging model - WebSphere Application Server insists upon it.
You can download free, developer-licensed WebSphere Application Server runtimes and Eclipse-based tooling from wasdev.net. The simplest approach would be to import your application source into the tooling, and deploy it onto a runtime from there.
The Karaf home page describes it as 'a small OSGi based runtime which provides a lightweight container onto which various components and applications can be deployed.' WebSphere Application Server is a Java EE-compliant application server. Until the advent of the Liberty Profile, it could not have been described as 'small'. Both runtimes are OSGi based.
We don't have a specific guide for migrating OSGi applications from Karaf to WebSphere, which is why I recommend that you try it and see what happens. Good luck - do let us know how you get on, either here or on the wasdev.net forums.
Regards,
Mark

OSGi Web application Tutorial

Can anybody provide me the good tutorial link for creating OSGi web application using JBoss Developer.I have to use OSGi framework but I cant figure out where to start and I am using JBoss developer tool for that.
There's a general introduction to OSGi web applications here, although it doesn't specifically discuss JBoss or JBoss developer. However, the principles are pretty universal. If you can create a normal OSGi bundle and a normal web application you can create an OSGi web application.

difference between WAB and WAR

I am a newbie to this and read about WABs , but wish to clear the basic difference -
I mean using osgi embedded in tomcat and making a WAR vs making a WAB ?
When should one consider each option ?
1) OSGI embedded in tomcat
2) tomcat in OSGI
3) using a WAB
OSGi embedded in a container (not only Tomcat!) is likely the only option when you are forced to a traditional JavaEE WAR deployment model, i.e. an IT department operates the container and you can only deloy WAR files to it. This bootstraps a whole OSGi framework within the web application and allows modular development within the web application. The web application is then composed as a set of OSGi bundles. It can also be used to migrate/transfer an existing legacy web application into OSGi modules. However, this will be challenging.
I'd like to call the second approach (Tomcat in OSGi) as a pure OSGi approach. Tomcat or any other Servlet container (eg., Jetty) can be deployed as a bundle (or a set of bundles) in an OSGi framework. The OSGi framework is the container. You don't have the full separation of a web application anymore. The can intersect. Some bundles/modules may implement web functionality and others may not. Core functionality (core bundles) can be reused by other web bundles.
The third option is a result of new spec work in OSGi. Basically, it's a web application with an OSGi bundle manifest. Thus, the whole web application can be deployed as a single OSGi bundle on any framework with WAB support. Technically, the bundle may be deployed as a web application to a Servlet container. But it gets access to a BundleContext. This allows the web application to inter-operate with other bundles or web applications running in the same framework.

How to integrate a SpringSource dm Server into another OSGi-based application server?

I would really like to use SpringSource dm Server, but our customer requires us to run our apps on their application server (Websphere). Is there a way to integrate SpringSource dm Server with other application servers? At least dm Server is build on OSGi, and many other application servers (including Websphere) are based on OSGi as well. Is it possible to run a SpringSource dm Server as a websphere component?
SpringSource dm Server is based on the Eclipse Equinox OSGi framework (and should not be confused with the Spring DM technology, included in dm Server, which can run on Equinox, Apache Felix, and Knopflerfish).
However, embedding dm Server in another application server, such as WebSphere Application Server, based on Equinox would be a non-trivial piece of work. It would be necessary to get both products to use the same version of Equinox, which they currently do not, then modify dm Server to support embedding in the server (e.g. to integrate with the host server's application invocation mechanism, thread pools, and class loading scheme).
If you think this support is important, please raise a requirement (which requires a simple registration) against dm Server.
Spring DM is deployed on a Knoplerfish OSGi implementation.
Websphere is deployed on an Equinox OSGi implmentation.
So the question becomes - are the two interchangeable? They both support R4, so I would say, yes, they are.
The next question would be to check dependencies, particularly with respect to things like HttpServices.
I would say this would be ok, but I think the final proof would be try deploying it. Easiest would be to drop the bundles into a Websphere deployment. You'll need your bundles and whatever spring bundles you're using.
I'm also interested in this topic. Another way of looking at this problem is that you want an application depoyable in both Spring dm server and a traditional app server (Websphere, weblogic, JBoss, ...).
The OSGi containers are embeddable inside non-OSGi applications, so it is theoretically possible to deploy an app to both Spring dm server and the same app + OSGi container to a traditional app server.
Now, as usual, the devil's in the details, including such topics of web development and bridging servlets between the outer app server and the OSGi container.
I do not think that this is really the case ...
see the following link for this: http://apsblog.burtongroup.com/2008/11/websphere-7-osgi.html
But it seems on the other side, that the trend is clear ... there will be a time when OSGI based application can be deployed on Java EE application servers

App Servers or Web Server for Spring Framework

first of all: that might be a newbie question. However after few searches I cannot find anything that would bring me further.
Basically what would be the reasons to choose an app server over a Spring framework to develop a medium complex web application? I am fairly new to Spring, did some hard core WebSphere for few years. While reading about Spring I see that it comes with a good bunch of features (transactions, persistence, messaging, connectors etc). Is Spring hard to scale or manage in a clustered environment?
Any comments welcome.
Thanks
Spring is awesome.
Your terminology is way off though. Spring is a Framework. It's a library that you use to write a web application.
An app Server is what your application runs in. You need both. For example, use the Spring Framework to create an app that runs in the Tomcat app server.
EAR files aren't a requirement for doing Java EE development.
It's not either/or: if you deploy a Java EE application you need a container of some kind.
I've deployed Spring apps on Tomcat and WebLogic. I think WebLogic is the best Java EE app server on the market. My decision about whether to deploy to it or not would be based strictly on availability.
You've seen that Spring has their own Java EE container now. It forks Tomcat and marries it with OSGi and Spring. I haven't tried it yet, but if the quality is similar to their framework it will be very promising indeed.
Are you really asking "When would I write an application using Spring? When should I choose EJB3?"
My preference these days is Spring. I can do persistence, transactions, messaging, web services, and everything else I need.
Bpapa,
you got me there, yes the terminology is wrong. I meant Spring + web container vs. App Servers. Surely the web app has to be deployed somewhere. I guess that shifts the question to the server side features as per my first post.
Topology example: Spring + Tomcat vs. WebSphere.
As a side note: people argue if Tomcat is an app server, many consider it rather a web container. You could not deploy an EAR file to Tomcat, can you? All it takes is a WAR, am I right? But that gets too academic.
Thanks a lot
Rod Johnson's "Expert 1:1 Java EE Development Without EJBs" is the basis for Spring. It's an excellent book, but I'd say it's a bit out of date now. The book was written with EJB2 in mind. It was published before Spring became an open source project. The framework is up to version 3.0 now, so I'd say that the book is of historical interest only. I'd recommend a more modern take on the question that takes Spring 3.0 and EJB3 into account.
%

Resources