• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why can't this code find Fiddler (i.e. LookupDiscoveryService)?  RSS feed

 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm running a simple program that needs to find a LookupDiscoveryService. I have Activatible-Fiddler (from sun) running on the same computer as the program I'm testing. For some reason when I use the following code, it always times out (or at least it returns null):
...elided...
ServiceDiscoveryManager sdMgr = new ServiceDiscoveryManager(null,null);
Class[] types = new Class[] { LookupDiscoveryService.class };
ServiceTemplate tmpl = new ServiceTemplate( null, types, null );
ServiceItem ldsItem = sdMgr.lookup( tmpl, null, 1*60*1000);
ldsItem is always null, and it takes a full minute before it returns. Any idea why? I have Fiddler registered in the public group, and as you can see above, it should be able to find the lookup easily through mutlicast since they're on the same computer.
Thanks in advance for any time/help!
- Robert Paris
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I partially solved the problem: I found someone else's code that after creating a ServiceDiscoveryManager, called Thread.sleep(10000L). I did that, and it found the services!! Why is this? If I have to do that every time, what do I do if the time to wait is 10002L one time and <10000 another time? Waiting an arbitrary amount of time seems a bit buggy and risky way to make that class.
Second problem:
Now that I found the service, I'm getting a new error:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.sun.jini.lease.landlord.LandlordLease
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.sun.jini.lease.landlord.LandlordLease
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.sun.jini.lease.landlord.LandlordLease
java.lang.ClassNotFoundException: com.sun.jini.lease.landlord.LandlordLease
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at sun.rmi.server.ActivatableRef.invoke(ActivatableRef.java:120)
at com.sun.jini.norm.NormServerImpl_Stub.renewFor(Unknown Source)
at com.sun.jini.norm.SetProxy.renewFor(SetProxy.java:127)
at com.sun.jini.norm.SetProxy.renewFor(SetProxy.java:95)
at Collector.setupLeaseRenewals(Unknown Source)
at Collector.main(Unknown Source)

Something similar happened to me once before and I couldn't figure out how to solve this. Why can't Norm find those classes? How do I make Norm find the classes? How can I anticipate problems like this in the future? Why does it happen? I mean, com.sun.jini.lease.landlord.LandlordLease is a sun class, so shouldn't Norm be able to find it?
Any help on this is GREATLY appreciated.
Thanks!
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am setting the codebase, and I can see it requests the jar file from there so I know I set it correctly. I did a work-around to solve the second problem, but I know I shouldn't have to do that (as explained below) so that problem really still exists. But now that I at least got that to "work" here is what happens next:
When I turn on debugging (using the following):
-Djava.security.debug=access,failure
-Dcom.sun.jini.sdm.debug=true
-Dcom.sun.jini.reggie.proxy.debug=true
-Dnet.jini.discovery.debug=true
I get the following error three times:
java.io.IOException: port number out of range 86507520
at net.jini.discovery.IncomingMulticastAnnouncement.<init> (IncomingMulticastAnnouncement.java:83)
at net.jini.discovery.LookupDiscovery$AnnouncementListener.run(LookupDiscovery.java:315)
However, my app. is able to find the LookupDiscoveryService anyways and call methods successfully on it. I then create an EventMailbox registration (using mercury) and use its listener to be the listener passed to the method "register" on Fiddler. However, when I later check the mailbox for any events, nothing is raised.
So continuing from the earlier problem in this email thread, I know have four problems:
1. I have to "sleep" for a bit or the services cannot be found
2. Norm is unable to find the LandLord Lease class, which is the class returned as the Listener on the MailboxRegistration.getlease()
I can make it work by adding sun-util.jar to my application's
codebase, but I shouldn't have to! I should only have to deal
with the interface "Lease", otherwise I can't program to the
Jini API but have to program to every implementation.
3. I get the error (only when debugging is on) of port number out of range, but it still finds the service. Does this matter?
4. Event though the Mailbox Listener was successfully passed to "regsiter" (got back a non-null LookupDiscoveryRegistration), no events are ever sent to my mailbox.
If anyone can see what I'm doing wrong in any of these steps that would be a huge help!
Thanks!
Robert
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!