in src/main/java/org/apache/sling/jcr/registration/impl/RmiRegistrationSupport.java [239:270]
private void register(String rmiName, Repository repository) {
System.setProperty("java.rmi.server.useCodebaseOnly", "true");
// try to create remote repository and keep it to ensure it is
// unexported in the unregister() method
try {
RemoteAdapterFactory raf = getRemoteAdapterFactory();
this.rmiRepository = raf.getRemoteRepository(repository);
} catch (RemoteException e) {
logger.error("Unable to create remote repository.", e);
return;
} catch (Exception e) {
logger.error("Unable to create RMI repository. jcr-rmi.jar might be missing.", e);
return;
}
try {
// check whether we have a private registry already
Registry privateRegistry = RmiRegistrationSupport.this.getPrivateRegistry();
if (privateRegistry != null) {
privateRegistry.bind(rmiName, this.rmiRepository);
this.rmiName = rmiName;
logger.info("Repository bound to {}", this.getRmiURL());
}
} catch (NoSuchObjectException nsoe) {
// the registry does not really exist
logger.warn("Cannot contact RMI registry at {}, repository not registered", RmiRegistrationSupport.this.registryPort);
} catch (Exception e) {
logger.error("Unable to bind repository via RMI.", e);
}
}