Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Servlet / Jini Lookup pbm

Reply
Thread Tools

Servlet / Jini Lookup pbm

 
 
felix
Guest
Posts: n/a
 
      03-15-2005
Hello,

I'm trying to contact a Jini lookup service (reggie) from a simple
servlet. I'm using Tomcat 5.5.7, Java 1.5.0_01, Jini 1.2.1 and
Solaris8.

The problem is that, after the call to LookupDiscoveryManager() (see
source code below), the "discovered()" method is never called back.

Here is what I get in my browser after an exec :
********
before LookupDiscoveryManager
end
********

I have successfully run a similar code in a standalone Java app (i.e.
without Tomcat / servlet), and everything is OK.

In fact, I have no error message nor Exception thrown. I simply
don't have any response from reggie.

Any help would be appreciate,
Olive

PS: I'm new to Tomcat and Jini.



=====================
== core servlet
=====================

protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/plain");
PrintWriter out = response.getWriter();

new searchALookup(out).start();
try {
Thread.sleep(30000);
} catch (InterruptedException ie) {
out.println("InterruptedException: " + ie.getMessage());
}
out.println("end");
out.close();
}



======================
== searchALookup.java
======================

import java.io.*;
import net.jini.core.discovery.LookupLocator;
import net.jini.core.lookup.*;
import net.jini.discovery.*;

public class searchALookup extends Thread implements DiscoveryListener
{

private LookupDiscoveryManager discover;
private PrintWriter sortie;

public chercheLookup(PrintWriter out) {
sortie = out;
}

public void run() {
try {
startServiceDiscovery();
} catch (IOException ioe) {
sortie.println("Error while connecting to service");
}
}

public synchronized void discovered(DiscoveryEvent dev) {
sortie.println("--> Discovered");
ServiceRegistrar[] lookup = dev.getRegistrars();
// We may have discovered one or more lookup services
sortie.println(lookup.length +" lookups decouverts");
}

public synchronized void discarded(DiscoveryEvent dev) {
sortie.println("discarded");
}

private void startServiceDiscovery()
throws IOException {

String[] groups = null;
LookupLocator[] locators = null;

try{
LookupLocator locator =
new LookupLocator("jini://REGGIE_HOSTNAME");
locators = new LookupLocator[]{locator};
groups=DiscoveryGroupManagement.NO_GROUPS;
}catch(java.net.MalformedURLException e){
groups = new String[]{"public"};
sortie.println("Groups ="+groups[0]);
}

// Initialize for receiving events from the lookup service
sortie.println("before LookupDiscoveryManager");
discover = new LookupDiscoveryManager(groups, locators, this);
}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JINI & reggie lookup service configuration. Mr. X. Java 0 07-05-2007 09:22 PM
A strange problem when I start JINI lookup service Zheng Da Java 0 02-26-2006 05:07 AM
Q: reading PBM laniik C++ 3 04-28-2005 08:53 AM
pbm opening a web application project vinyaraghavan@mailasia.com ASP .Net 1 01-05-2005 05:57 PM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM



Advertisments