O
Olivier Ricou
Hi,
I don't understand why I cannot make a stub (proxy) of a class
which inherite from a Interface which extends Runnable.
It surprise me even more because I can make a stub of a class
which implements directly Runnable and of course the Interface
(move the Runnable from Plouf to PloufServer and it works...).
Here is an exemple which gives (java 1.4, Sun and IBM) :
java.rmi.server.ExportException: cannot get proxy interfaces; nested
exception is:
java.lang.IllegalArgumentException: illegal remote method encountered:
public abstract void java.lang.Runnable.run()
Best regards,
Olivier.
-------------------------
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Plouf extends Remote, Runnable
{
public String plouf(int n) throws RemoteException;
}
--------------------------
import java.rmi.*;
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.tcp.TcpServerEndpoint;
import net.jini.config.*;
import net.jini.export.*;
public class PloufServer implements Plouf
{
static String[] configArgs = new String[] {"jeri.config"};
public void run()
{
try
{
Exporter exporter =
new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
new BasicILFactory());
Remote stub = exporter.export(this);
}
catch (Exception e){System.out.println(e);}
}
public String plouf(int n) throws RemoteException
{ return new String("Plouf"); }
public static void main(String[] args)
{
if (System.getSecurityManager() == null)
System.setSecurityManager(new RMISecurityManager());
try {
PloufServer f = new PloufServer();
Thread ft = new Thread(f);
ft.start();
System.out.println("Plouf Server ready.");
}
catch (Exception e) { System.out.println(e); }
}
}
---------------
the full run :
/usr/share/jini/lib/jini-core.jar:.:/usr/share/jini/lib/jini-ext.jar \
PloufServer
Plouf Server ready.
java.rmi.server.ExportException: cannot get proxy interfaces; nested
exception is:
java.lang.IllegalArgumentException: illegal remote method encountered:
public abstract void java.lang.Runnable.run()
I don't understand why I cannot make a stub (proxy) of a class
which inherite from a Interface which extends Runnable.
It surprise me even more because I can make a stub of a class
which implements directly Runnable and of course the Interface
(move the Runnable from Plouf to PloufServer and it works...).
Here is an exemple which gives (java 1.4, Sun and IBM) :
java.rmi.server.ExportException: cannot get proxy interfaces; nested
exception is:
java.lang.IllegalArgumentException: illegal remote method encountered:
public abstract void java.lang.Runnable.run()
Best regards,
Olivier.
-------------------------
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Plouf extends Remote, Runnable
{
public String plouf(int n) throws RemoteException;
}
--------------------------
import java.rmi.*;
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.tcp.TcpServerEndpoint;
import net.jini.config.*;
import net.jini.export.*;
public class PloufServer implements Plouf
{
static String[] configArgs = new String[] {"jeri.config"};
public void run()
{
try
{
Exporter exporter =
new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
new BasicILFactory());
Remote stub = exporter.export(this);
}
catch (Exception e){System.out.println(e);}
}
public String plouf(int n) throws RemoteException
{ return new String("Plouf"); }
public static void main(String[] args)
{
if (System.getSecurityManager() == null)
System.setSecurityManager(new RMISecurityManager());
try {
PloufServer f = new PloufServer();
Thread ft = new Thread(f);
ft.start();
System.out.println("Plouf Server ready.");
}
catch (Exception e) { System.out.println(e); }
}
}
---------------
the full run :
-Djava.security.policy=./no.security -classpath \java -Djava.rmi.server.codebase="http://localhost/" \
/usr/share/jini/lib/jini-core.jar:.:/usr/share/jini/lib/jini-ext.jar \
PloufServer
Plouf Server ready.
java.rmi.server.ExportException: cannot get proxy interfaces; nested
exception is:
java.lang.IllegalArgumentException: illegal remote method encountered:
public abstract void java.lang.Runnable.run()