RMI problem: java.lang.ClassNotFoundException: Interface
850654Mar 26 2011 — edited Mar 27 2011Hi, i am encountering some difficulties to set a RMI communication, this is my code:
Server:+
public class ServerRMI {
public static final int numPortRMIRegistry = 1099;
public static void main(String[] args) {
try {
LocateRegistry.createRegistry(numPortRMIRegistry);
System.setSecurityManager ( new RMISecurityManager() );
DAOInt<Joueur> joueur = new DAOJoueur();
Naming.rebind("rmi://localhost/game", joueur);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Client:+
public class ClientRMI {
final int PORT = 1099;
public Joueur getJoueur(String Login)
{
Joueur jou = new Joueur();
try {
LocateRegistry.getRegistry(PORT);
System.setSecurityManager ( new RMISecurityManager() );
Remote r = Naming.lookup("rmi://localhost/game");
DAOInt<Joueur> joueur = (DAOInt<Joueur>) r;
jou = joueur.read(Login); // for DB..
return jou;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
I run rmic thanks to my build.xml "*Ant*"
<rmic classname="dao.DAOJoueur" base="${classes}" />
it gives Stub and Skeleton, but when i execute this i get this error on my client:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: dao.DAOInt
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at clientMetierServ.ClientRMI.getJoueur(ClientRMI.java:26)
at serverMertierServ.RequestStatement.run(RequestStatement.java:61)
at java.lang.Thread.run(Unknown Source)
I note that dao.DAOInt is located on my server !
Can someone help me Please