You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Tim Jones <ti...@mccarthy.co.nz> on 2014/05/21 03:52:03 UTC
OSGI and Spring
I am interested to hear views on where OSGI and Spring is heading. I realise
this is a fairly broad topic but I think is worth discussing.
I have noticed that a lot of answers on this forum and others suggest not
using Spring but instead Blueprint or Declarative Services, particularly if
starting from scratch.
There are probably many arguments against using Spring ranging from 'Spring
oriented technologies have a very unmodular streak in them' through to less
active participation by SpringSource after ceasing work on their own OSGI
container.
However Spring has been adopted by many projects throughout the world,
particularly in applications development. I have struggled to find good
migration guides helping move a project from Spring to OSGI without Spring.
For example there have been a few guides
http://www.oracle.com/technetwork/articles/java/springtojavaee-522240.html
to move from Spring to JEE. Is anyone aware of similar guides for migrating
to OSGI.
Take the project I currently work on as an example which uses Karaf/Felix +
Spring + Camel + other. Spring is used amongst other things to anotate
transactions, anotate classes (Component, Service, Repository,
ManagedResource etc), autowire beans, reduce JDBC complexity (JdbcTemplate
etc), define Camel routes, Spring security, Spring MVC, define transaction
managers and data sources. This list is probably typical of many Spring
applications. While some of these things have similar Blueprint/DS counter
parts I would be interested in hearing how others have approached migrating
away from Spring e.g. alternatives to anotating transactions?
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by Tim Jones <ti...@mccarthy.co.nz>.
Says me trying to absolve myself of all responsibility- I should have
probably said arguments that have been presented to me range from 'There are
probably many arguments against using Spring ranging from Spring oriented
technologies have a very unmodular streak in them' ... I personally don't
know enough about the internals of Spring or OSGI to comment one way or the
other but I can tell you that the person who made the comment is widely
regarded as an expert in OSGI so probably has sound reason for making such a
comment.
Although having said that I have been involved with a Spring-dm/Felix/Karaf
project for a while and think we have been reasonably well served by
Spring-dm up until now. I think the context of the comment was probably made
looking from the perspective of an OSGI purest.
I am also keen to see a good Spring-OSGI integration story both from a
selfish motivation in that we have significant investment in Spring-dm but
also more importantly I think it will help the uptake of OSGI given the
current size of the Spring user base.
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033648.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by constv <cv...@healthedge.com>.
Tim Jones wrote
> There are probably many arguments against using Spring ranging from
> 'Spring oriented technologies have a very unmodular streak in them'...
Thought I'd comment on this particular statement... We really shouldn't be
making (or spreading) unfounded statements like this. Applications are only
as modular as our architectural skills allow them to be. Spring is all about
modularity, if a developer/architect knows what modularity really means and
is determined to implement it. Any technology can be misused, and OSGi or
Spring are no different. there is no silver bullet. It takes skills,
education, and vision to get things right, no matter what technology one is
using.
That said, I believe that not supporting seamless Spring integration in OSGi
might be a wrong way to go. Spring is one of the most essential platforms in
the Java space, it provides so much great leverage for almost every area of
enterprise development, enforcing programming best practices and modularity
on all levels. It goes way beyond DI and configurations, obviously. And its
documentation by far is the best - while OSGi documentation is very scarce,
sprinkled all over the net, and most of it is obsolete and inaccurate -
quite unfortunately. It would be nice to see solid integration with Spring
added to Aires Blueprint. That would give OSGi a boost, in my opinion.
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033611.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by Tim Jones <ti...@mccarthy.co.nz>.
I am not sure that will help as even though the JDK doesn't have permgen the
leaks are classloader leaks e.g. a class loaded by the class loader can't be
collected due to some thing having a reference to it, this class has a
reference to the class loader which in turn means all other classes loaded
by the class loader can't be collected. Summed up here
http://www.infoq.com/news/2013/03/java-8-permgen-metaspace 'In the end,
classloader leaks can still occur as before'. The main culprit we have found
is CGLIB which is widely used by Spring.
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033232.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by Ryan Moquin <fr...@gmail.com>.
JDK 8 doesn't have perm gen anymore... and I believe there are some
enhancements to prevent these class unloading issues that happen....
Ryan
On May 21, 2014 6:47 PM, "Tim Jones" <ti...@mccarthy.co.nz> wrote:
> Charlie, it is not so much that I am afraid of embracing OSGI. The
> application I work on for my day job runs on Karaf, it has been in
> production at a number of sites for a couple of years. One of the main
> reasons we chose OSGI was the ability to hot swap, although in reality this
> hasn't proved to be as rosy as written on the box due to perm gen memory
> leaks, essentially limiting the number if times a bundle can be reinstalled
> before a full server restart.
>
> I am concerned as to what direction we need to take in the future since the
> application has significant dependency on Spring and it seems there is at
> the moment and end date forced upon us by the spring-dm dependency.
>
> The alternatives you have mentioned still seem rather immature for me to
> put
> a case to management to introduce into a stable running system (we pretty
> much run 24x7 and use the hot swapping for emergency upgrades) but I will
> take a closer look thanks.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033229.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
Re: OSGI and Spring
Posted by Charlie Mordant <cm...@gmail.com>.
Can't you use Aries bean 'factory-ref' and 'init-method' to implement
factorybeans?
I knew that post processors weren't supported, but never faced the
factorybean issue (maybe I didn't dealt with it).
2014-06-13 10:14 GMT+02:00 Guillaume Nodet <gn...@apache.org>:
>
>
>
> 2014-06-13 10:02 GMT+02:00 Charlie Mordant <cm...@gmail.com>:
>
> As an addition, you can always use Spring beans with Aries-bp, as you
>> would do with any other bp bean.
>>
>>
> There are two big limitations in Aries that makes reusing spring beans
> difficult:
> * FactoryBean are not supported
> * type based discovery is not supported
>
> So for beans that are somewhat tied to any spring api, it's not
> necessarily an easy task to migrate.
>
>
>
>> The only thing you cannot do without spring-dm/gemini is the use of
>> Spring namespaces/annotations.
>>
>
> Namespaces are supported by spring-dm/gemini afaik.
>
>
>> I'm pretty sure it's relatively easy to bridge annotation support
>> configuring the right Spring beans: I dropped my devs on it due to my
>> ignorance (5 years ago) on an OSGI-ready Spring classpath scanner
>> implementation.
>>
>> Best regards,
>>
>>
>> 2014-06-12 23:21 GMT+02:00 Krzysztof Sobkowiak <krzys.sobkowiak@gmail.com
>> >:
>>
>> If many people still need a Spring integration with OSGi it should be
>>> no problem. ServiceMix Bundles sub-project provides now Spring bundles. We
>>> have also Eclipse Gemini Blueprint (successor of Spring DM), but I don't
>>> know how active the project is. But usage of Gemini for Spring integration
>>> forces usage of the Gemini's Blueprint implementation too. Personally I
>>> don't like such a configuration. I prefer usage of Spring DM which, I think
>>> so, doesn't need to die. Indeed it's died. But it can be reanimated and
>>> provide a lightweight Spring integration -- probably as a new project based
>>> on Spring DM code base. If people want (or need) to use Spring in OSGi
>>> there should be no problem. They must only invest some effort to make the
>>> Spring OSGi integration still living
>>>
>>> Best regards
>>> Krzysztof
>>>
>>>
>>> On 12.06.2014 22:57, Tim Jones wrote:
>>>
>>> I am adding a few URLs as I think it is will be of interest to others who are
>>> looking for direction re the future of Spring and OSGI
>>>
>>> -- Somehow I wonder how well future spring versions will behave in OSGi. I
>>> think we should start to at least warn our users that continued use of
>>> spring in OSGi is an increasing risk. http://karaf.922171.n3.nabble.com/Spring-OSGi-bundles-no-longer-being-released-td4031212.html
>>>
>>> -- Are we really going to let die the Spring integration with OSGi?http://karaf.922171.n3.nabble.com/Re-The-future-of-the-Spring-with-Fabric8-td4033455.html
>>>
>>> -- We should also make clear that Spring DM is dead. And that in general
>>> Spring on OSGi is not a good ideahttps://github.com/fabric8io/fabric8/issues/1634
>>>
>>>
>>>
>>> --
>>> View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033485.html
>>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>>
>>>
>>>
>>> --
>>> Krzysztof Sobkowiak
>>>
>>> JEE & OSS Architect | Technical Architect @ Capgemini
>>> Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
>>> <http://www.pl.capgemini-sdm.com/> | Wroclaw
>>> e-mail: krzys.sobkowiak@gmail.com | Twitter: @KSobkowiak
>>> Calendar: goo.gl/yvsebC
>>>
>>
>>
>>
>> --
>> Charlie Mordant
>>
>> Full OSGI/EE stack made with Karaf:
>> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>>
>
>
--
Charlie Mordant
Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent
Re: OSGI and Spring
Posted by Guillaume Nodet <gn...@apache.org>.
2014-06-13 10:02 GMT+02:00 Charlie Mordant <cm...@gmail.com>:
> As an addition, you can always use Spring beans with Aries-bp, as you
> would do with any other bp bean.
>
>
There are two big limitations in Aries that makes reusing spring beans
difficult:
* FactoryBean are not supported
* type based discovery is not supported
So for beans that are somewhat tied to any spring api, it's not necessarily
an easy task to migrate.
> The only thing you cannot do without spring-dm/gemini is the use of Spring
> namespaces/annotations.
>
Namespaces are supported by spring-dm/gemini afaik.
> I'm pretty sure it's relatively easy to bridge annotation support
> configuring the right Spring beans: I dropped my devs on it due to my
> ignorance (5 years ago) on an OSGI-ready Spring classpath scanner
> implementation.
>
> Best regards,
>
>
> 2014-06-12 23:21 GMT+02:00 Krzysztof Sobkowiak <kr...@gmail.com>
> :
>
> If many people still need a Spring integration with OSGi it should be no
>> problem. ServiceMix Bundles sub-project provides now Spring bundles. We
>> have also Eclipse Gemini Blueprint (successor of Spring DM), but I don't
>> know how active the project is. But usage of Gemini for Spring integration
>> forces usage of the Gemini's Blueprint implementation too. Personally I
>> don't like such a configuration. I prefer usage of Spring DM which, I think
>> so, doesn't need to die. Indeed it's died. But it can be reanimated and
>> provide a lightweight Spring integration -- probably as a new project based
>> on Spring DM code base. If people want (or need) to use Spring in OSGi
>> there should be no problem. They must only invest some effort to make the
>> Spring OSGi integration still living
>>
>> Best regards
>> Krzysztof
>>
>>
>> On 12.06.2014 22:57, Tim Jones wrote:
>>
>> I am adding a few URLs as I think it is will be of interest to others who are
>> looking for direction re the future of Spring and OSGI
>>
>> -- Somehow I wonder how well future spring versions will behave in OSGi. I
>> think we should start to at least warn our users that continued use of
>> spring in OSGi is an increasing risk. http://karaf.922171.n3.nabble.com/Spring-OSGi-bundles-no-longer-being-released-td4031212.html
>>
>> -- Are we really going to let die the Spring integration with OSGi?http://karaf.922171.n3.nabble.com/Re-The-future-of-the-Spring-with-Fabric8-td4033455.html
>>
>> -- We should also make clear that Spring DM is dead. And that in general
>> Spring on OSGi is not a good ideahttps://github.com/fabric8io/fabric8/issues/1634
>>
>>
>>
>> --
>> View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033485.html
>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Krzysztof Sobkowiak
>>
>> JEE & OSS Architect | Technical Architect @ Capgemini
>> Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
>> <http://www.pl.capgemini-sdm.com/> | Wroclaw
>> e-mail: krzys.sobkowiak@gmail.com | Twitter: @KSobkowiak
>> Calendar: goo.gl/yvsebC
>>
>
>
>
> --
> Charlie Mordant
>
> Full OSGI/EE stack made with Karaf:
> https://github.com/OsgiliathEnterprise/net.osgiliath.parent
>
Re: OSGI and Spring
Posted by Charlie Mordant <cm...@gmail.com>.
As an addition, you can always use Spring beans with Aries-bp, as you would
do with any other bp bean.
The only thing you cannot do without spring-dm/gemini is the use of Spring
namespaces/annotations.
I'm pretty sure it's relatively easy to bridge annotation support
configuring the right Spring beans: I dropped my devs on it due to my
ignorance (5 years ago) on an OSGI-ready Spring classpath scanner
implementation.
Best regards,
2014-06-12 23:21 GMT+02:00 Krzysztof Sobkowiak <kr...@gmail.com>:
> If many people still need a Spring integration with OSGi it should be no
> problem. ServiceMix Bundles sub-project provides now Spring bundles. We
> have also Eclipse Gemini Blueprint (successor of Spring DM), but I don't
> know how active the project is. But usage of Gemini for Spring integration
> forces usage of the Gemini's Blueprint implementation too. Personally I
> don't like such a configuration. I prefer usage of Spring DM which, I think
> so, doesn't need to die. Indeed it's died. But it can be reanimated and
> provide a lightweight Spring integration -- probably as a new project based
> on Spring DM code base. If people want (or need) to use Spring in OSGi
> there should be no problem. They must only invest some effort to make the
> Spring OSGi integration still living
>
> Best regards
> Krzysztof
>
>
> On 12.06.2014 22:57, Tim Jones wrote:
>
> I am adding a few URLs as I think it is will be of interest to others who are
> looking for direction re the future of Spring and OSGI
>
> -- Somehow I wonder how well future spring versions will behave in OSGi. I
> think we should start to at least warn our users that continued use of
> spring in OSGi is an increasing risk. http://karaf.922171.n3.nabble.com/Spring-OSGi-bundles-no-longer-being-released-td4031212.html
>
> -- Are we really going to let die the Spring integration with OSGi?http://karaf.922171.n3.nabble.com/Re-The-future-of-the-Spring-with-Fabric8-td4033455.html
>
> -- We should also make clear that Spring DM is dead. And that in general
> Spring on OSGi is not a good ideahttps://github.com/fabric8io/fabric8/issues/1634
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033485.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
>
>
> --
> Krzysztof Sobkowiak
>
> JEE & OSS Architect | Technical Architect @ Capgemini
> Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
> <http://www.pl.capgemini-sdm.com/> | Wroclaw
> e-mail: krzys.sobkowiak@gmail.com | Twitter: @KSobkowiak
> Calendar: goo.gl/yvsebC
>
--
Charlie Mordant
Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent
Re: OSGI and Spring
Posted by Krzysztof Sobkowiak <kr...@gmail.com>.
If many people still need a Spring integration with OSGi it should be no
problem. ServiceMix Bundles sub-project provides now Spring bundles. We
have also Eclipse Gemini Blueprint (successor of Spring DM), but I don't
know how active the project is. But usage of Gemini for Spring
integration forces usage of the Gemini's Blueprint implementation too.
Personally I don't like such a configuration. I prefer usage of Spring
DM which, I think so, doesn't need to die. Indeed it's died. But it can
be reanimated and provide a lightweight Spring integration -- probably
as a new project based on Spring DM code base. If people want (or need)
to use Spring in OSGi there should be no problem. They must only invest
some effort to make the Spring OSGi integration still living
Best regards
Krzysztof
On 12.06.2014 22:57, Tim Jones wrote:
> I am adding a few URLs as I think it is will be of interest to others who are
> looking for direction re the future of Spring and OSGI
>
> -- Somehow I wonder how well future spring versions will behave in OSGi. I
> think we should start to at least warn our users that continued use of
> spring in OSGi is an increasing risk.
> http://karaf.922171.n3.nabble.com/Spring-OSGi-bundles-no-longer-being-released-td4031212.html
>
> -- Are we really going to let die the Spring integration with OSGi?
> http://karaf.922171.n3.nabble.com/Re-The-future-of-the-Spring-with-Fabric8-td4033455.html
>
> -- We should also make clear that Spring DM is dead. And that in general
> Spring on OSGi is not a good idea
> https://github.com/fabric8io/fabric8/issues/1634
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033485.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
--
Krzysztof Sobkowiak
JEE & OSS Architect | Technical Architect @ Capgemini
Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
<http://www.pl.capgemini-sdm.com/> | Wroclaw
e-mail: krzys.sobkowiak@gmail.com <ma...@gmail.com> |
Twitter: @KSobkowiak
Calendar: goo.gl/yvsebC
Re: OSGI and Spring
Posted by Tim Jones <ti...@mccarthy.co.nz>.
I am adding a few URLs as I think it is will be of interest to others who are
looking for direction re the future of Spring and OSGI
-- Somehow I wonder how well future spring versions will behave in OSGi. I
think we should start to at least warn our users that continued use of
spring in OSGi is an increasing risk.
http://karaf.922171.n3.nabble.com/Spring-OSGi-bundles-no-longer-being-released-td4031212.html
-- Are we really going to let die the Spring integration with OSGi?
http://karaf.922171.n3.nabble.com/Re-The-future-of-the-Spring-with-Fabric8-td4033455.html
-- We should also make clear that Spring DM is dead. And that in general
Spring on OSGi is not a good idea
https://github.com/fabric8io/fabric8/issues/1634
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033485.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by Tim Jones <ti...@mccarthy.co.nz>.
Thanks Guillaume. Our primary reason for looking at Spring 4 at the moment is
that there is a possibility they will drop/fix CGLIB which we think is the
main cause of our class loader leaks.
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033254.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by Guillaume Nodet <gn...@apache.org>.
The range problem also applies to Gemini which can't be wired to spring 4
afaik.
And this needs to be tested, as it may be the case that spring-dm and/or
gemini rely on spring internals and would not work on spring 4.
If that's a problem for gemini, it may still be possible to provide a patch
and expect a release ...
But I don't really see any reason to not support spring 3 for quite some
time.
2014-05-22 22:30 GMT+02:00 Tim Jones <ti...@mccarthy.co.nz>:
> So to summarise, if Gemini was to become no longer viable, then as it
> stands
> at the moment, post Spring 3, it will not be possible to use the Spring
> namespace in Karaf without re-packaging the spring-dm bundles or altering
> the manifest for the version range as mentioned by Achim
> (
> http://karaf.922171.n3.nabble.com/Spring-4-0-2-and-spring-dm-tt4033093.html#a4033176
> )?
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033252.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
Re: OSGI and Spring
Posted by Tim Jones <ti...@mccarthy.co.nz>.
So to summarise, if Gemini was to become no longer viable, then as it stands
at the moment, post Spring 3, it will not be possible to use the Spring
namespace in Karaf without re-packaging the spring-dm bundles or altering
the manifest for the version range as mentioned by Achim
(http://karaf.922171.n3.nabble.com/Spring-4-0-2-and-spring-dm-tt4033093.html#a4033176)?
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033252.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by Ryan Moquin <fr...@gmail.com>.
I also have been getting that feeling about Gemini.
On May 22, 2014 7:22 AM, "Guillaume Nodet" <gn...@apache.org> wrote:
> My biggest fear is that gemini is not really active anymore.
> See
> http://git.eclipse.org/c/gemini.blueprint/org.eclipse.gemini.blueprint.git/log/
>
>
> 2014-05-22 1:17 GMT+02:00 Tim Jones <ti...@mccarthy.co.nz>:
>
>> I have been trying to follow a few posts on Gemini blueprint and Karaf and
>> was aware it is on the road map and it looks promising. I am a bit
>> concerned
>> (perhaps unfairly) about the future level of testing of Gemini blueprint
>> with Karaf as up until now I thought Karaf was very much Aries based. Is
>> support for Gemini blueprint on Karaf going to receive as much attention
>> as
>> Aries?
>>
>>
>>
>> --
>> View this message in context:
>> http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033233.html
>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>
>
>
Re: OSGI and Spring
Posted by Guillaume Nodet <gn...@apache.org>.
My biggest fear is that gemini is not really active anymore.
See
http://git.eclipse.org/c/gemini.blueprint/org.eclipse.gemini.blueprint.git/log/
2014-05-22 1:17 GMT+02:00 Tim Jones <ti...@mccarthy.co.nz>:
> I have been trying to follow a few posts on Gemini blueprint and Karaf and
> was aware it is on the road map and it looks promising. I am a bit
> concerned
> (perhaps unfairly) about the future level of testing of Gemini blueprint
> with Karaf as up until now I thought Karaf was very much Aries based. Is
> support for Gemini blueprint on Karaf going to receive as much attention as
> Aries?
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033233.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
Re: OSGI and Spring
Posted by Tim Jones <ti...@mccarthy.co.nz>.
I have been trying to follow a few posts on Gemini blueprint and Karaf and
was aware it is on the road map and it looks promising. I am a bit concerned
(perhaps unfairly) about the future level of testing of Gemini blueprint
with Karaf as up until now I thought Karaf was very much Aries based. Is
support for Gemini blueprint on Karaf going to receive as much attention as
Aries?
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033233.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by Guillaume Nodet <gn...@apache.org>.
Gemini blueprint has full support for spring afaik.
It's quite difficult to setup in karaf 3.x, but it should be fairly easy to
do with karaf 4.x.
2014-05-22 0:46 GMT+02:00 Tim Jones <ti...@mccarthy.co.nz>:
> Charlie, it is not so much that I am afraid of embracing OSGI. The
> application I work on for my day job runs on Karaf, it has been in
> production at a number of sites for a couple of years. One of the main
> reasons we chose OSGI was the ability to hot swap, although in reality this
> hasn't proved to be as rosy as written on the box due to perm gen memory
> leaks, essentially limiting the number if times a bundle can be reinstalled
> before a full server restart.
>
> I am concerned as to what direction we need to take in the future since the
> application has significant dependency on Spring and it seems there is at
> the moment and end date forced upon us by the spring-dm dependency.
>
> The alternatives you have mentioned still seem rather immature for me to
> put
> a case to management to introduce into a stable running system (we pretty
> much run 24x7 and use the hot swapping for emergency upgrades) but I will
> take a closer look thanks.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033229.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
Re: OSGI and Spring
Posted by Tim Jones <ti...@mccarthy.co.nz>.
Charlie, it is not so much that I am afraid of embracing OSGI. The
application I work on for my day job runs on Karaf, it has been in
production at a number of sites for a couple of years. One of the main
reasons we chose OSGI was the ability to hot swap, although in reality this
hasn't proved to be as rosy as written on the box due to perm gen memory
leaks, essentially limiting the number if times a bundle can be reinstalled
before a full server restart.
I am concerned as to what direction we need to take in the future since the
application has significant dependency on Spring and it seems there is at
the moment and end date forced upon us by the spring-dm dependency.
The alternatives you have mentioned still seem rather immature for me to put
a case to management to introduce into a stable running system (we pretty
much run 24x7 and use the hot swapping for emergency upgrades) but I will
take a closer look thanks.
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033229.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by Charlie Mordant <cm...@gmail.com>.
Hi Tim,
It could be a partial answer to your questions, but here's the way I see
things on the Gap between EE/Osgi world:
The post you mentioned is related to an old Karaf version: Karaf 3.0.x
works fine with CDI, you could see it running with my CXFRS-CDI portable
extensions, Validation (JSR-303), ConfigAdmin, Camel ones... Just download
my project and make a magic mvn clean install on it :). I hope Pax-CDI will
raise and become a standard as blueprint is.
It may be not as modularizable as blueprint, but I think it's just a dev
manpower effort (I just know that Harald Weldmann contribute on it, but
hope some folks will pursue the effort, maybe myself too).
Concerning the @Transactional annotation, I didn't succeed to make the
deltaspike work in OSGI, but think I'm just too young and inexperimented
for it (I'm a 5 years old JEE folk, but just a one year old out of work
night coder on OSGI/Karaf), and I see some good moves concerning Aries
Community (Java 8 support, many mails on tests migrations and a kind of
motivation to make things better and better...). Also Pax-CDI/Jpa/Data
issue could make things move on (take a closer look at
https://ops4j1.jira.com/browse/PAXCDI-89 to see progress).
Concerning my use Spring-sec in my framework (for more details:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent/blob/master/net.osgiliath.framework/net.osgiliath.features.karaf-features/net.osgiliath.features.karaf-features.itests/net.osgiliath.features.karaf-features.itests.security
),
I don't use any spring annotations, just the underlying sec stuff with xml
injection: userdetails, roles, etc... But if you really want annotations,
you can easily make a CDI portable extension to handle it and make a
deltaspike, Pax, SMX (or even Osgiliath ? :O) contribution: we're all
opened, and we will all reverse back to each communities depending on the
case, it could even be possible to have the both of the two worlds
available out of the box (I tried Gemini-blueprint that perfectly handled
spring namespaces and annotations, and an aries bridge is always
possible/maybe affordable with little hacks).
For example, a typical CDI extension have just to listen OSGI service spawn
(i.e. spring userdetailsservice implementation via a servicetracker), and
intercept bean calls that are typed by annotations (@PreAuthorize?) to
throw an exception (UnAuthorizedException) if any, or let the client call
the method.
Finally, as an OSGI evangelist, I personally think that you're on the good
way: don't be afraid of embracing OSGI (and particularly Karaf) because
some unresolved EE issues will be solved the OSGI nice way of easily
resolving complex issues. I made the same path to go here, starting J2E,
moving to Spring (that I liked very much, that pushed me to the dynamic
world) then discovering OSGI, with a lot of apprehension, but with a
stronger benefit that makes me advocating for this kind of solution
comparing with others (JEE, Spring).
I can make a non exhaustive list of thinks OSGI is able to solve that
JEE/Spring stack will never have:
* Hot swap of implementations (feature:install myapp is just a real
pleasure).
* Semantic versioning (your users will know when they have to change their
call to your API).
* Hot deployement (no need to stop your server)
* ESB/EIP/BUS... (far more easy than stopping your server to redeploy your
business module access), and provided by Karaf without any effort you'll do
with JBoss.
* Application rationalization (no more wars, ears, just jars and manifests).
* Scalability (take a look at hazecast, karaf cave... and you'll see that
you're already on the cloud).
* A responsive community: we're not as many as the JEE ones, but much more
responsive and listening for feedback/enhancement.
Best Regards,
2014-05-21 22:40 GMT+02:00 Tim Jones <ti...@mccarthy.co.nz>:
> Thanks Charlie, I wasn't aware of the deltaspike-jpa @Transactional
> annotation. Though I am a bit concerned reading posts such as
> https://groups.google.com/forum/#!topic/ops4j/-yNNwvz5yNY that it is
> still a
> bit early to adopt as an alternative.
>
> I don't see how you can continue using spring-security with the Blueprint
> beans wiring mechanism as I thought it would require a Spring application
> context e.g. for a method annotated with @PreAuthorize would this not
> require a Spring application context to work?
>
> So given that 'Blueprint does not aim to replace the entire Spring
> framework, only the bean wiring stuff' then what is the migration path for
> a
> Spring dependent application post Spring 3 as Spring-dm out of the box only
> supports [2.5.6,4)?
>
>
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033227.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
--
Charlie Mordant
Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent
Re: OSGI and Spring
Posted by Tim Jones <ti...@mccarthy.co.nz>.
Thanks Charlie, I wasn't aware of the deltaspike-jpa @Transactional
annotation. Though I am a bit concerned reading posts such as
https://groups.google.com/forum/#!topic/ops4j/-yNNwvz5yNY that it is still a
bit early to adopt as an alternative.
I don't see how you can continue using spring-security with the Blueprint
beans wiring mechanism as I thought it would require a Spring application
context e.g. for a method annotated with @PreAuthorize would this not
require a Spring application context to work?
So given that 'Blueprint does not aim to replace the entire Spring
framework, only the bean wiring stuff' then what is the migration path for a
Spring dependent application post Spring 3 as Spring-dm out of the box only
supports [2.5.6,4)?
--
View this message in context: http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211p4033227.html
Sent from the Karaf - User mailing list archive at Nabble.com.
Re: OSGI and Spring
Posted by Charlie Mordant <cm...@gmail.com>.
Hi,
Blueprint does not aim to replace the entire Spring framework, only the
bean wiring stuff.
You can continue to use spring-sec, spr-data, spring-whatever but with the
Blueprint beans wiring mecanism (or even CDI with pax-cdi if you prefer
annotations) instead of the Spring one.
Blueprint wiring mecanism is pretty similar to Spring xml based one (you
just have different namespaces and a different location of your xml file).
Also DS and blueprint allow to export services between bundles, something
you didn't have to do with Spring because of the underlying architecture
(you can see OSGI service as a kind of web-service for the JVM).
For your transaction example, you have two alternatives: either using
aries-transaction where you declare the transactional aspect in your xml
descriptor, or use deltaspike-jpa @Transactional annotation (you can maybe
find an example of usage within OSGI on the pax-jpa repository).
Regards,
--
*Charlie Mordant*
*Full OSGI/EE stack with
Karaf:https://github.com/OsgiliathEnterprise/net.osgiliath.parent
<https://github.com/OsgiliathEnterprise/net.osgiliath.parent>*
2014-05-21 3:52 GMT+02:00 Tim Jones <ti...@mccarthy.co.nz>:
> I am interested to hear views on where OSGI and Spring is heading. I
> realise
> this is a fairly broad topic but I think is worth discussing.
>
> I have noticed that a lot of answers on this forum and others suggest not
> using Spring but instead Blueprint or Declarative Services, particularly if
> starting from scratch.
>
> There are probably many arguments against using Spring ranging from 'Spring
> oriented technologies have a very unmodular streak in them' through to less
> active participation by SpringSource after ceasing work on their own OSGI
> container.
>
> However Spring has been adopted by many projects throughout the world,
> particularly in applications development. I have struggled to find good
> migration guides helping move a project from Spring to OSGI without Spring.
> For example there have been a few guides
> http://www.oracle.com/technetwork/articles/java/springtojavaee-522240.html
> to move from Spring to JEE. Is anyone aware of similar guides for migrating
> to OSGI.
>
> Take the project I currently work on as an example which uses Karaf/Felix +
> Spring + Camel + other. Spring is used amongst other things to anotate
> transactions, anotate classes (Component, Service, Repository,
> ManagedResource etc), autowire beans, reduce JDBC complexity (JdbcTemplate
> etc), define Camel routes, Spring security, Spring MVC, define transaction
> managers and data sources. This list is probably typical of many Spring
> applications. While some of these things have similar Blueprint/DS counter
> parts I would be interested in hearing how others have approached migrating
> away from Spring e.g. alternatives to anotating transactions?
>
>
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/OSGI-and-Spring-tp4033211.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>