cancel
Showing results for 
Search instead for 
Did you mean: 

InitialContext().listBindings()

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

This feature is currently not supported but will likely be supported in a future release.

Regards,

\-- Vladimir

Former Member
0 Kudos

Hi Vladimir,

Thanks for the clarification that listBindings is not supported in the current release. Is there a work around to achieve the same functionality? If so can you let us know of the work around?

Best Regards,

Chris

Vlado
Advisor
Advisor
0 Kudos

No, I haven't said that listBindings is not supported in the current release. I said that this feature ("to list all session beans implementing a remote interface") is not supported.

From the javadoc:

listBindings(String name) -- Enumerates the names bound in the named context, along with the objects bound to them.

So, the param must be the name of a context. The EJB lookup string is not a name of a context.