[
https://issues.jboss.org/browse/AS7-5492?page=com.atlassian.jira.plugin.s...
]
James Livingston edited comment on AS7-5492 at 9/5/12 1:32 AM:
---------------------------------------------------------------
The problem occurs when there are two WritableServiceBasedNamingStore instances using the
same ServiceRegistry.
When you bind an object using store1, it gets added into the service registry and added to
store1's boundServices list.
When you use lookup() on store2 it will find the object in the service registry.
When you use listBindings() on store2 it will not find the object in store2's
boundServices since it was only added to store1's.
This can be seen by adding the following to
naming/src/test/java/org/jboss/as/naming/WritableServiceBasedNamingStoreTestCase.java
--
@Test
public void testListBindings() throws Exception {
final Name name = new CompositeName("nested/test");
final Object value = new Object();
List<Binding> bindings = null;
Object result = null;
WritableServiceBasedNamingStore.pushOwner(container);
try {
store.bind(name, value);
result = store.lookup(new CompositeName("nested/test"));
bindings = store.listBindings(new CompositeName("nested"));
} finally {
WritableServiceBasedNamingStore.popOwner();
}
assertEquals(value, result);
assertNotNull(bindings);
assertEquals(1, bindings.size());
assertEquals(value, bindings.get(0).getObject());
WritableServiceBasedNamingStore store2 = new
WritableServiceBasedNamingStore(container, ContextNames.JAVA_CONTEXT_SERVICE_NAME);
try {
store.bind(name, value);
result = store2.lookup(new CompositeName("nested/test"));
bindings = store2.listBindings(new CompositeName("nested"));
} finally {
WritableServiceBasedNamingStore.popOwner();
}
assertEquals(value, result);
assertNotNull(bindings);
assertEquals(1, bindings.size());
assertEquals(value, bindings.get(0).getObject());
}
--
The first set which uses the same store passes, but the second set using the different
store object will pass the lookup() bit but fail to find anything using listBindings.
was (Author: jameslivingston):
The problem occurs when there are two WritableServiceBasedNamingStore instances using
the same ServiceRegistry.
When you bind an object using store1, it gets added into the service registry and added to
store1's boundServices list.
When you use lookup() on store2 it will find the object in the service registry.
When you use listBindings() on store2 it will not find the object in store2's
boundServices since it was only added to store1's.
JNDI listBindings() does not work for items in java:jboss/exported
------------------------------------------------------------------
Key: AS7-5492
URL:
https://issues.jboss.org/browse/AS7-5492
Project: Application Server 7
Issue Type: Bug
Components: Naming
Affects Versions: 7.1.2.Final (EAP)
Reporter: James Livingston
Assignee: Eduardo Martins
When an object is bound to java:jboss/exported/abc/def (for example using the naming
subsystem in standalone.xml), it can be retrieved from a remote client with
context.lookup("abc/def").
Calling context.listBindings("abc") return 0 bindings. This appears to be
because ServiceBasedNamingStore.lookup() checks the service registry and then the
boundServices, but listBindings() only checks the boundServices.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira