This page contains an archived post to the Jini Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Jini Multicast problem
Posted by jianbo on January 18, 2001 at 9:09 AM
I am so frustrated!!! Please help! These are part of my code: ---------------------------------- public class FortuneStreamStart implements ServiceIDListener { public static void main(String[] args) throws Exception { new FortuneStreamStart(); Object keepAlive = new Object(); synchronized(keepAlive) { try { keepAlive.wait(); } catch(InterruptedException e) { } } } public FortuneStreamStart(String[] args) { System.setSecurityManager(new RMISecurityManager()); String[] groups = new String[] { "" }; LookupDiscoveryManager lookupDisc = new LookupDiscoveryManager(groups, null, null); JoinManager joinMgr = new JoinManager(new FortuneStreamImpl(), null, this, lookupDisc, null); } public void serviceIDNotify(ServiceID serviceID) { System.out.println(serviceID); } } ..... public class FortuneStreamImpl extends UnicastRemoteObject implements java.io.Serializable { public FortuneStreamImpl() throws IOException, RemoteException { super(); } public String toString() { return "jianbo"; } } ---------------------------------- It is quite simple, right? Well, here is the problem: After I started it, I got the ServiceID: 6bc8a1c8-6a5a-44eb-99ff-e43732177ebb. Then, I used Jini's Browser to look it up. The Browser showed these: ================================================ Matching services: 2 Service ID: 6bc8a1c8-6a5a-44eb-99ff-e43732177ebb Service instance: null Service ID: bcf362b3-6b22-4fc1-985d-cf054279e3d9 Service instance: com.sun.jini.reggie.RegistrarProxy@df501ae ServiceInfo: name=Lookup manufacturer=Sun Microsystems, Inc. vendor=Sun Microsystems, Inc. version=1.1 model= serialNumber= BasicServiceType: type=Lookup ================================================ I don't understand why my Service instance is null, so I changed JoinManager() line in my cold to: JoinManager joinMgr = new JoinManager(new String("Test"), null, this, lookupDisc, null); Then, the Browser showed these: ================================================ Matching services: 3 Service ID: 09f196e4-b6ff-45ef-ac6c-d8fb0f214ac3 Service instance: Test Service ID: 6bc8a1c8-6a5a-44eb-99ff-e43732177ebb Service instance: null Service ID: bcf362b3-6b22-4fc1-985d-cf054279e3d9 Service instance: com.sun.jini.reggie.RegistrarProxy@df501ae ServiceInfo: name=Lookup manufacturer=Sun Microsystems, Inc. vendor=Sun Microsystems, Inc. version=1.1 model= serialNumber= BasicServiceType: type=Lookup ================================================ You see: The Service instance is "Test" now. Why my Service instace is null? Why "new String()" works but my "new FortuneStreamImpl()" doesn't? I have tried so many things I can think of, but I simply cannot fix it. Please tell me what I did wrong. Thanks a lot. (I am using Jini1_1 and JDK1.3.)
Replies:
|