I took quite some time to look into this problem since it's marked as a blocker and we are approching 2.1.4 release. I've nailed the problem down to the xbean-naming code, but I'm not sure how to fix it. Would like to get other's advice. Below is the summary of my findings -
1. The sympton is that when a connection factory and a queue are created and started, and then stopped/uninstalled, their JNDI entry will continue to exist in the global context unless the server is restarted.
2. When stoping/uninstalling them, org.apache.xbean.naming.context.AbstractContext.removeDeepBinding() will eventually be called, which finds the last context whose size > 2 in the context chain, then tries to remove the entry from this context (say Context A). This results in calling org.apache.xbean.naming.context.WritableContext$NestedWritableContext.removeBinding(), which uses removeNotEmptyContext=false to do removal. Unfortunately the context (say Context B) being removed (in Context A) is always not empty, resulting a ContextNotEmptyException which is ignored in org.apache.geronimo.gjndi.KernelContextGBean.removeBinding().
I don't have enough background to understand why Context A is chosen this way and why removeNotEmptyContext is set to false. Can anyone shed some light here?