javax.naming.CommunicationException - no security manager: R
altes-kind Jan 15, 2009 4:36 AMHi!
I'm working on an application with a client and a server. I'm using JBoss 4.2 and Java 1.6.
On client side I bind an object to JNDI and try to lookup this object on server side.
CLIENT:
Object callback = ...; Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); p.put(Context.PROVIDER_URL, "jnp://localhost:1099"); Context context = new InitialContext(p); context.bind (newBindName, callback); // Bind the callback object to JNDI
This is the Callback class:
public class Callback
implements BCServiceProxy, Serializable, Remote {
/**
* Logger
*/
private static final Log log = LogFactory.getLog (Callback.class);
/**
* The listener to be notified about new postboxentries
*/
private transient PostboxListener postboxListener;
/**
* Constructor
* @param postboxListener listener to be notified about new postboxentries
*/
public Callback (PostboxListener postboxListener) {
this.postboxListener = postboxListener;
}
/**
* @inheritDoc
*/
public String gotPostboxEntry (PostboxEntry postboxEntry) {
String rc = null;
if (postboxListener!=null) {
rc = postboxListener.gotPostboxEntry (postboxEntry);
}
return rc;
}
}After the binding I can see the object at the JNDIView in Global JNDI Namespace:
+- a5xk891BCServiceProxyPostboxTask 41232010727767 (class: de.postbox.proxies.bcservice.Callback)
SERVER:
The remote interface BCServiceProxy which the Callback class implements is in a JAR which is deyploed on the server.
public interface BCServiceProxy
extends Serializable, Remote {
/**
* Called when the next postboxentry is known
* @param postboxEntry the next postboxentry
* @return String the id of the workitem, which should be delivered next.
* For null the order of the delivered postboxentries will not be modified
* @throws RemoteException
*/
public String gotPostboxEntry (PostboxEntry postboxEntry) throws RemoteException;
}Now I try to make the lookup on server side:
Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); p.put(Context.PROVIDER_URL, "jnp://localhost:1099"); Context context = new InitialContext(p); Object objref = context.lookup(requestorbindname);
This results in an exception:
javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: No ClassLoaders found for: de.postbox.proxies.bcservice.Callback (no security manager: RMI class loader disabled)]
Why do I get this exception?
Is it because I see the concrete class in JNDIView (see above). Shouldn't I see there something like this: +- a5xk891BCServiceProxyPostboxTask 41232010727767 (proxy: $Proxy99 implements interface de.postbox.services.bcservice.proxy.BCServiceProxy)?
Any help will be greatly appreciated!