Re: Class Server requests

Dave Brosius <[email protected]>
Newsgroups gmane.comp.java.sun.jini
Message-ID <002901c72cf0$933a1960$6501a8c0@MeBigFatGuy>
Command line:

java -classpath .;..\lib\jini-core.jar;..\lib\jini-ext.jar -Djava.security.policy=..\policy.all com.mebigfatguy.jinitest.JiniTestService

Setting codebase

 public static void main(String[] args) {
  try {
   System.setSecurityManager (new RMISecurityManager ());
   
   int port = Integer.valueOf(args[0]).intValue();
   JiniClassServer cs = new JiniClassServer(port);
   cs.start();
   InetAddress.getLocalHost();
   System.setProperty("java.rmi.server.codebase", "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + port);

   discovery = new LookupDiscovery(LookupDiscovery.ALL_GROUPS);
   leaseManager = new LeaseRenewalManager();
   
   discovery.addDiscoveryListener(new JiniTestDiscoveryListener(leaseManager));
   
   JOptionPane.showMessageDialog(null, "Shutdown service");
  } catch (Exception e) {
   e.printStackTrace();
  }
 }

Installing service

 public void discovered(DiscoveryEvent event) {
  try {
   ServiceRegistrar[] registrars = event.getRegistrars();
 
   Entry[] attr = new Entry[1];
         attr[0] = new Name("JiniTest");

   ServiceItem item = new ServiceItem(null, new JiniTestImpl(), attr);
   LeaseListener listener = new JiniTestLeaseListener();
 
   for (ServiceRegistrar registrar : registrars) {
     ServiceRegistration reg = registrar.register(item, Lease.FOREVER);
     leaseManager.renewUntil(reg.getLease(), Lease.FOREVER, listener); 
   }  
  } catch (RemoteException re) {
   re.printStackTrace();  
  }
 }  


----- Original Message ----- 
From: "Dan Creswell" <[email protected]>
To: "Dave Brosius" <[email protected]>
Cc: <[email protected]>
Sent: Sunday, December 31, 2006 5:49 AM
Subject: Re: Class Server requests


> Hi Dave,
> 
> Dave Brosius wrote:
>> 1) I run launch-all.exe to run the environment. My service is run
>> with -Djava.security.policy=policy.all where the policy allows all
>> 
> 
> So you're running direct from the command-line?  If so, can you post it
> please?
> 
>> 2) Wrote my own, that is embedded in the service 'installer' that simply
>> does getResourceAsStream on the relevent class file and pumps it out as an
>> http response. Of course it never gets that far, as i am never asked for a
>> class, only '/' (i also get HEAD requests for '/' as well).
>>
> 
> Okay - so what did you set the service's codebase to?
> 
>> 3) 2.1
>> 
>> 4) Well, registration is failing as i get ClassNotFoundExceptions. Which is
>> certainly understandable as my class server gets gibberish for requests.
>>
> 
> Which suggests a configuration issue - likely codebase.....
> 
>> Dec 31, 2006 5:21:30 AM com.sun.jini.reggie.RegistrarProxy handleException
>> INFO: unmarshalling failure
>> java.lang.ClassNotFoundException: com.mebigfatguy.jinitest.JiniTestImpl
> 
> Hmmm, so I could be wrong on this one but looking ahead this ^^^^^
> classname looks a bit odd.  Are you using JERI Exporters or are you
> using standard RMI/UnicastRemoteObject?  I suspect you _might_ be
> passing the wrong thing to JoinManager in your service's init code.
> 
> Just a note for later......
> 
> Dan.
> 
>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>        at
>> net.jini.loader.pref.PreferredClassLoader.loadClass(PreferredClassLoa
>> der.java:922)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>        at java.lang.Class.forName0(Native Method)
>>        at java.lang.Class.forName(Class.java:242)
>>        at
>> net.jini.loader.pref.PreferredClassProvider.loadClass(PreferredClassP
>> rovider.java:613)
>>        at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
>>        at net.jini.loader.ClassLoading.loadClass(ClassLoading.java:138)
>>        at
>> net.jini.io.MarshalInputStream.resolveClass(MarshalInputStream.java:2
>> 96)
>>        at
>> java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:153
>> 8)
>>        at
>> java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
>>        at
>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
>> 693)
>>        at
>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
>>        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
>>        at net.jini.io.MarshalledInstance.get(MarshalledInstance.java:358)
>>        at net.jini.io.MarshalledInstance.get(MarshalledInstance.java:287)
>>        at
>> com.sun.jini.proxy.MarshalledWrapper.get(MarshalledWrapper.java:127)
>>        at com.sun.jini.reggie.Item.get(Item.java:141)
>>        at com.sun.jini.reggie.Item.toServiceItem(Item.java:177)
>>        at com.sun.jini.reggie.Matches.get(Matches.java:62)
>>        at
>> com.sun.jini.reggie.RegistrarProxy.lookup(RegistrarProxy.java:128)
>>        at com.sun.jini.example.browser.Browser.genMatches(Browser.java:535)
>>        at com.sun.jini.example.browser.Browser.genText(Browser.java:439)
>>        at com.sun.jini.example.browser.Browser.setText(Browser.java:426)
>>        at com.sun.jini.example.browser.Browser.update(Browser.java:1260)
>>        at com.sun.jini.example.browser.Browser.resetTmpl(Browser.java:797)
>>        at
>> com.sun.jini.example.browser.Browser.access$3200(Browser.java:141)
>>        at
>> com.sun.jini.example.browser.Browser$Lookup.actionPerformed(Browser.j
>> 
>> ----- Original Message -----
>> From: "Dan Creswell" <[email protected]>
>> To: "Dave Brosius" <[email protected]>
>> Cc: <[email protected]>
>> Sent: Sunday, December 31, 2006 4:54 AM
>> Subject: Re: Class Server requests
>> 
>> 
>>> Hi Dave,
>>>
>>> Need some more information:
>>>
>>> (1) How are you running your service?  And can you post the relevant
>>> configs, scripts etc.
>>>
>>> (2) What are you using as the class server and how are you running it?
>>>
>>> (3) Which version of Jini are you using?
>>>
>>> (4) Can you explain why you are concerned by the GET request?  Is
>>> something not working and, if so, can you provide more details?
>>>
>>> Happy New Year,
>>>
>>> Dan.
>>>
>>> Dave Brosius wrote:
>>>> Howdy,
>>>>
>>>>    New Jini dabbler, here.
>>>>
>>>> I was trying to get my service to run, set up a Class server, and the
>>>> server
>>>> is getting the request
>>>>
>>>> GET / HTTP/1.1
>>>>
>>>> What am i supposed to return for that?
>>>>
>>>> I was expecting the name of some class?
>>>>
>>>>
>>>>
>>>> thanks,
>>>>
>>>> dave
>>>>
>>>> --------------------------------------------------------------------------
>>>>
>>>> Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
>>>> Community Web Site:  http://jini.org
>>>> jini-users Archive:
>>>> http://archives.java.sun.com/archives/jini-users.html
>>>> Unsubscribing:       email "signoff JINI-USERS"  to
>>>> [email protected]
>>>>
>>>
>> 
>> --------------------------------------------------------------------------
>> Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
>> Community Web Site:  http://jini.org
>> jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
>> Unsubscribing:       email "signoff JINI-USERS"  to [email protected]
>> 
>

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.