Feb 27th, 2011, 02:56 PM
Strange Behavior in SpringDM when refreshing Dependencies
I have a Bundle A which defines a simple JAXRS resource and the exports that package. I have another Bundle S which defines a spring context in which the bean from A is instantiated. To do this, of course, S imports the package from A. Now, I modify the bean in A and then 'osgi update' bundle A. Then I 'osgi refresh'
A I would expect that to automatically refresh S and then re-wire S so that it connects to the new version of the package exported by A and thus S should see a new version of the bean.
Funny thing is, this works about 5% of the time. The other 95% of the time the bean defined in A simply vanishes from S. It's like S is looking for the old version of the packages and when it can't find them it simply silently gives up.
Feb 27th, 2011, 04:12 PM
After much digging (and crying) I was able to I was finally able to locate the source of the strange, problematic behavior. I had two versions of the javax.ws.rs.Path annotation in my container. One was coming from jsr311-api-1.1.1.jar and the other was coming from jersey-core-1.5.jar. When I was refreshing the bundle containing my JAXRS resources I suspect it was, most of the time, getting linked to a different one than the one Jesery was using to determine what is, and isn't, a root resource provider. This led to the class seeming to simply vanish...
Well, off to have more fun in OSGi land. At least now I can dynamically reload my JAXRS resources without having to restart the entire OSGi container.