The attempt to use clustering on a singe machine using two
different JVMs was successful. However when I tried to use the clustering
mechanism using two different machines, it failed.
The approach I am using is RMI registry. Each machine starts
an instance of its own RMI Registry. Before getting the
EntityManagerFactory, to the application, the following code is used to
decorate the session with the RemoteCommandManager Object.
Session session = JpaHelper.getServerSession(emf);
AbstractSession sessionImpl = (AbstractSession)
session;
RemoteCommandManager cm = new RemoteCommandManager(sessionImpl);
cm.setShouldPropagateAsynchronously(true);
cm.getDiscoveryManager().setAnnouncementDelay(10);
cm.getDiscoveryManager().setMulticastGroupAddress("239.193.0.32");
cm.getDiscoveryManager().setMulticastPort(3121);
cm.getDiscoveryManager().setPacketTimeToLive(5);
cm.getTransportManager().setNamingServiceType(TransportManager.REGISTRY_NAMING_SERVICE);
cm.setUrl("rmi://"+getLocalHost()+":"+rmiProperties.getRmiPort());
cm.setServerPlatform(sessionImpl.getServerPlatform());
sessionImpl.setCommandManager(cm);
sessionImpl.setShouldPropagateChanges(true);
cm.initialize();
Thread.sleep(2000);
If I try to use the single registry on one of the machine
and try to connect the other, it gives me
Java.rmi.AccessException because it is not able to find the
RemoteServer object on it. I tried even using the security policy file but of
no help.
Request if anyone can help me with it. Am I missing
something?
Legal Notice: This transmission, including any attachments, is confidential, proprietary, and may be privileged. It is intended solely for the intended recipient. If you are not the intended recipient, you have received this transmission in error and you are hereby advised that any review, disclosure, copying, distribution, or use of this transmission, or any of the information included therein, is unauthorized and strictly prohibited. If you have received this transmission in error, please immediately notify the sender by reply and permanently delete all copies of this transmission and its attachments