Skip to Content
0
Former Member
Feb 23, 2009 at 11:09 AM

InitialContext().listBindings()

52 Views

Hello,

I am trying to list all session beans implementing a remote interface and bound to a particular JNDI registry. Lets say the remote interface is com.xyz.RemoteInterface. There are 2 session beans implementing the remote and deployed on the server. To list the 2 beans I am using the code of the type below -

I am using the code in the form below -

String JNDI = "ejb:/interfaceName=com.xyz.RemoteInterface, interfaceType=remote";
NamingEnumeration<javax.naming.Binding> bindings = getContext().listBindings(lookupName);
while(bindings.hasMoreElements()) {
    System.out.println(bindings.nextElement().getName());
}

When I do this I get the following exception.

java.lang.UnsupportedOperationException: The class JNDIejbResolverContext serves for resolving the entries in the ejb scheme. It supports only the 'public Object lookup(String name) throws NamingException' operation.

at com.sap.engine.services.ejb3.runtime.impl.JNDIejbResolverContext.throwException(JNDIejbResolverContext.java:35)

at com.sap.engine.services.ejb3.runtime.impl.JNDIejbResolverContext.listBindings(JNDIejbResolverContext.java:107)

at javax.naming.InitialContext.listBindings(InitialContext.java:447)

at javax.naming.InitialContext.listBindings(InitialContext.java:447)

Can anyone guide me how can I achieve the listing if this doesnt work.

Best Regards,

Christopher