users@glassfish.java.net

OSGi War Bundle deployment issues

From: Larry Touve <ltouve_at_potomacfusion.com>
Date: Wed, 23 Mar 2011 09:40:13 -0500

I have an OSGi war bundle that I've been developing and deploying for almost a year now. I am starting to encounter strange behavior when updating it. I recently updated to GF V3.1-b38, and am running on Windows 7.

I deploy it by copying it into the autodeploy/bundles folder. Everything has worked fine for quite awhile. When I made changes and copied the new war file over, it would stop and start the new one fine. Now I have to restart my domain if I change the war file. It doesn't seem to undeploy properly. When I delete the war file from the autodeploy/bundles folder I see that the bundle is stopped:

2011-03-23 09:28:38,146 DEBUG FelixDispatchQueue [rest-services] BundleEvent STOPPED
2011-03-23 09:28:38,150 DEBUG FelixDispatchQueue [rest-services] BundleEvent UNRESOLVED
2011-03-23 09:28:38,151 DEBUG FelixDispatchQueue [rest-services] BundleEvent UNINSTALLED
2011-03-23 09:28:38,151 DEBUG FelixDispatchQueue [org.apache.felix.framework] FrameworkEvent PACKAGES REFRESHED
2011-03-23 09:28:38,151 INFO Event null (56) [org.apache.felix.fileinstall] Uninstalled C:\glassfishV3.1b38\glassfish\domains\jcms\autodeploy\bundles\rest-services.war
2011-03-23 09:28:38,152 DEBUG FelixDispatchQueue [org.apache.felix.framework] FrameworkEvent PACKAGES REFRESHED

Using the OSGi system console, I can verify that the bundle is no longer present. However, I am still able to hit the URLs that the web services provide. So it appears as if the service is cached somewhere and still running. If I try to redeploy the war file, I get the following error:

2011-03-23 10:12:08,064 DEBUG FelixDispatchQueue [rest-services] BundleEvent INSTALLED
2011-03-23 10:12:08,066 INFO Event null (56) [org.apache.felix.fileinstall] Installed C:\glassfishV3.1b38\glassfish\domains\jcms\autodeploy\bundles\rest-services.war
2011-03-23 10:12:08,070 DEBUG FelixDispatchQueue [rest-services] BundleEvent RESOLVED
2011-03-23 10:12:08,126 DEBUG FelixDispatchQueue [rest-services] BundleEvent STARTED
2011-03-23 10:12:08,127 INFO Event null (56) [org.apache.felix.fileinstall] Started bundle: file:/C:/glassfishV3.1b38/glassfish/domains/jcms/autodeploy/bundles/rest-services.war
2011-03-23 10:12:08,127 INFO Event null (56) [org.apache.felix.fileinstall] Started bundle: file:/C:/glassfishV3.1b38/glassfish/domains/jcms/autodeploy/bundles/rest-services.war
2011-03-23 10:12:08,131 ERROR pool-9-thread-1 [org.glassfish.osgijavaeebase] Failed while deploying bundle rest-services [279]
2011-03-23 10:12:08,131 WARN pool-9-thread-1 [org.glassfish.osgijavaeebase] Failed to deploy bundle rest-services [279]
org.glassfish.osgijavaeebase.DeploymentException: Deployment of rest-services [279] failed because of following reason: Failed while deploying bundle rest-services [279]
: org.glassfish.osgiweb.ContextPathCollisionException: context path [/jcms] is same for following bundles: [277, 278, 279]
        at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:125)
        at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
        at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
        at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
        at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
        at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.glassfish.osgiweb.ContextPathCollisionException: context path [/jcms] is same for following bundles: [277, 278, 279]
        at org.glassfish.osgiweb.ContextPathCollisionDetector.preDeploy(ContextPathCollisionDetector.java:95)
        at org.glassfish.osgiweb.OSGiWebDeploymentRequest.detectCollisions(OSGiWebDeploymentRequest.java:202)
        at org.glassfish.osgiweb.OSGiWebDeploymentRequest.preDeploy(OSGiWebDeploymentRequest.java:196)
        at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:108)
        at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
        ... 10 more

Bundles 277 & 278 were the previous deployments of this war bundle, and they do not show up in the OSGi System Console. Anybody got any ideas?

Thanks,
Larry