Hi,
This is expected behavior.
I believe the snapshot bundle you're updating still used(such as
import package) by other bundles. Let's say the snapshot bundle is
bundle A, and another bundle B import package from Bundle A. So the
scenario is that
Before you update Bundle A, in OSGi container
Bundle A in Revision1<============Bundle B in Revision1
After you update Bundle A, in OSGi container
Bundle A in Revision1<============Bundle B in Revision1 and there's
also a Bundle A in Revision2(so here in the OSGi container two
revisions for BundleA, but only Revision1 take effect)
at this moment Bundle B in Revision1 still refer the Bundle A in
Revision1, you need explicitly refresh Bundle A which in turn will
cause all other bundles use(and transitively use) Bundle A to re-
resolve(this operation is really heavy loaded work as so many bundles
might be resolved again, it depend on if BundleA play a very basic
bundle role), after that the new revision2 for BundleA take effect.
So after you refresh BundleA, in OSGi container,
Bundle A in Revision2<============Bundle B in Revision1
At this moment you changes for that snapshot BundleA take effect.
This kind of two-steps update/refresh operation avoid unnecessarily
frequently resolving lots of bundles(as it's cpu consuming task), you
can updated several bundles and then refresh once to get all changes
take effect as one goal, and this behavior is totally from OSGi spec.
The different scenario is that if the SNAPSHOT Bundle A is self-used,
no other Bundles import package or OSGi service from Bundle A, then
update BundleA means the new revision will take effect immediately.
Hope this helps
Freeman
On 2010-12-31, at 上午8:59, khein wrote:
I'm having trouble updating SNAPSHOT bundles via mvn. The basic
scenario is
that I run the Karaf server, make changes via an IDE to a bundle,
recompile
and deploy the bundle to my local maven repository. The attempt to
update
the bundle.
I can see pax-url-mvn tracking down the bundle in the correct
location (in
my local repository), and it even posts a error message
appropriately if the
bundle is not present (i.e. I've purposefully deleted it), so I know
it it
attempting to load the newly built bundle. If I stop Karaf and
restart, the
changes are found and loaded.
However, when I update and 'install' the bundle via maven, it still
continues to stop/start the original bundle. I can tell this via the
logging I've put into the @PostCreate and @PreDestroy methods within
the
bundle and by having pax-url-mvn logging in DEBUG mode.
I've tried many configurations of the org.ops4j.pax.url.mvn.cfg file
and
don't believe the issue is there any longer. It seems that the
bundle is
located, but never really 'loaded'. Maybe it continues to use a
cached
version?
When I do an uninstall/install cycle I do get the different bundle
to load,
however, the @PostConstruct message is no longer logged...but status
shows
STARTED. Very confusing.
Help? Any ideas what to look at in tracking this down?
snipped of debug showing it is finding the SNAPSHOT appropriately:
--- --- --- --- ---
13:33:56,147 | DEBUG | d-69 |
org.ops4j.pax.url.mvn.internal.Connection
| Collecting versions from repository
[file:/Users/khein/.m2/repository/,releases=false,snapshots=true]
13:33:56,147 | DEBUG | d-69 |
org.ops4j.pax.url.mvn.internal.Connection
| Resolving metadata
13:33:56,149 | DEBUG | d-69 |
org.ops4j.pax.url.mvn.internal.Connection
| Resolving latest version
13:33:56,149 | DEBUG | d-69 |
org.ops4j.pax.url.mvn.internal.Connection
| Resolving snapshot version [0.11.24-SNAPSHOT]
13:33:56,150 | DEBUG | d-69 |
org.ops4j.pax.url.mvn.internal.Connection
| Resolving metadata
--
View this message in context:
http://karaf.922171.n3.nabble.com/Bundle-Snapshot-Update-Issues-tp2170343p2170343.html
Sent from the Karaf - User mailing list archive at Nabble.com.
--
Freeman Fang
------------------------
FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org