Hi, I'd like to propose the following fix: [1]. It fixes IvmContext.list()/listBindings(). There are several issues that are being addressed:
* MyNamingEnumeration.gatherNodes() adds the wrong federated context entries in the result set. It should add the nodes belonging to the "initiallyRequestedNode", otherwise in some cases we are adding nodes from two different parents (in other words we are mixing two different sub-contexts), which is incorrect. * MyNamingEnumeration.isMyChild() considers entries that are NOT children to the "parent" tree as such - the original code was using "parentTree", to check if a given node is a child to another one, which is wrong. The "parentTree" relationship indicates only the physical layout of the tree, and NOT the relationship between the sub-contexts and their entries. Hence it considers for instance "java:global" to be a child of "java:module" which is obviously incorrect. The relationship between a context and the bound entries is denoted by the "parent" node. So when listing a context isMyChild should rely only on the "parent" node. There is one exception - the top level contexts (app, global, etc) which do not have a parent. * Wrong parentNode is passed as argument to gatherNodes in case we are listing the context for any "IvmContext != this. When we call IvmContext.list(), it looks up the relevant IvmContext and tries to build a NamingEnumeration for its sub-tree. So far so good, but the looked up context might be different than the context on which we called list(). If that's the case, the wrong NameNode is passed as "parent" to gatherNodes() and as a result some nodes are not listed. PS: This issue is relevant for tomee 1.7.x as well. i noticed it does not correctly list the naming tree as well. It also does not list the federated contexts which was implemented in [3]. [1] https://github.com/apache/tomee/pull/88 [2] https://issues.apache.org/jira/browse/TOMEE-2087 [3] https://github.com/apache/tomee/pull/81 Best regards, Svetlin