Wednesday, March 4, 2009

Spring Dm(OSGi) integration with terracota

I have tried integrating terracotta with spring DM and it works fine. My use case included a instance a stand alone java,jetty web server,apache tomcat and Spring Dm connected to the same instance of terracotta sharing a custom class as the root.
The changes i had to make were
Added the Terracotta lib and shared classes under boot delegation path of Spring DM –
1. In springsource-dm-server-ee-1.0.1.RELEASE\lib\java6-server.profile org.osgi.framework.bootdelegation = \ com.tc.*,\--> àddedd this is to avoid errors from Spring DM which tries to load these classes from Bundle class loader share.* --> Classes which are shared
2 .Copied shared jar under springsource-dm-server-ee-1.0.1.RELEASE\lib\
The above changes are doen to ensure that teh shared classes are loaded by the boot classloader which will enable terracotta toidentify this class and share with other processes()stadalobe,jetty.tomcat).In teh above case since the shared jar is added intothe bootdelegation , any chage in the teracotta shared classes will need restart of the spring dm server.

The other staratergy to achive the same is by changing the classloader names in all the other processes which are connected to terracotta, but i found this more complicated and cumbersome.

2 comments:

Walter Harley said...

Hi, Sudheer. In Terracotta 3.0, which is prerelease right now, there's a new configuration option that lets you share classes across different applications without needing to rename the loaders. I don't think the product docs for 3.0 are quite ready yet, but you can get a glimpse of it by looking at the feature request in Jira.

Sudheer Krishna said...

yes.. thats right .We did speak to the terracotta guys and they said they will be OSGi friendly in their future releases.

Also there has been lot of progress from teracotta on the spring perspective.

http://www.terracotta.org/web/display/orgsite/Web+App+Reference+Implementation

 
Free Domain Names @ .co.nr!