Hi

I have made one servlet for JINI/RIO for
http://compiere-mfgscm.sourceforge.net/

It works and it is license apache v2.

It is not already online because it is part of a lot of softs, I am currently testings.
I will publish during may probably.


If you need I can send you elements.
Contact me on my mail.

Andre

Olivier Dusacq wrote:

Hello,

I think I have found something very interesting to solve my problem. I tried to put the Jini jar-files (jini-core.jar, jini-ext.jar and sun-util.jar) in $CATALINA_HOME/common/lib, or $CATALINA_BASE/shared/lib, or anywhere if I set correctly the classpath in setclasspath.sh (instead of placing these jars in WEB-INF/lib as I did before). After that, the LookupDiscoveryManager() seems OK. I suspect a classloader issue, but I'm not sure. Maybe somebody on this list could explain this ?

But now, I'm stuck with some NoClassDefFoundError or ClassCastException... I think it's the "same" classloader problem. In fact, I don't know if it's good idea to place jars in the common folders. But is there any other solution to make Jini and Tomcat working together ? Is it possible to tell to Tomcat: "now use the Webapp classloader when dealing with these 3 Jini jars" ??

Thanks, Olive


Olivier Dusacq wrote:

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);
}
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to