Java rmi
Résolu
houba80
Messages postés
52
Date d'inscription
Statut
Membre
Dernière intervention
-
arth Messages postés 10414 Date d'inscription Statut Contributeur Dernière intervention -
arth Messages postés 10414 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
je suis entrain de réaliser un projet avec java.rmi mais lors de l'exécution de mon application j'aurais une erreur au serveur, j'ai essayer un petit exercice qu'on a réaliser lors de la séance de TP mais ça marche pas aussi chez moi pourtant je sais bien qu'il est exécutable voila je vais vous donner le source de l'exercice de TP et aidez moi SVP, j'ai pensé que le problème est de mon système d'exploitation (Windows 7) mais avec un autre PC c'était en marche:
import java.rmi.*;
interface Sommeih extends Remote
{
public int somme() throws RemoteException;;
}
import java.rmi.RemoteException;
import java.rmi.server.ServerNotActiveException;
import java.rmi.server.UnicastRemoteObject;
public class SommeihImpl extends UnicastRemoteObject implements Sommeih
{
protected SommeihImpl() throws RemoteException
{
super();
}
public int somme() throws RemoteException
{
int a=5,b=3;
int result=a+b;
System.out.println("methode somme invoquee..."+result);
return result;
}
}
import java.rmi.*;
public class SommeihClient
{
public static void main(String[]args)
{
try
{
System.out.println("recherche de l'objet serveur...");
Sommeih somme=
(Sommeih)Naming.lookup("Sommeih");
System.out.println("invocation de la methode sayHello...");
int result=somme.somme();
System.out.println("affichage de resultat :");
System.out.println(result);
System.exit(0);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
import java.rmi.Naming;
public class SommeihServer
{
public static void main (String []args)
{
try
{
System.out.println("creation de l'objetserveur...");
Sommeih somme=new SommeihImpl();
System.out.println("referencement dans le RMIRegistry...");
//Naming.rebind("rmi://server/Sommeih",somme);
Naming.rebind("//localhost/Sommeih",somme);
//System.out.println(java.net.InetAdress.);
//Naming.rebind("Sommeih",somme);
System.out.println("attente d'invocations -CTRL-C pour stopper");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
je suis entrain de réaliser un projet avec java.rmi mais lors de l'exécution de mon application j'aurais une erreur au serveur, j'ai essayer un petit exercice qu'on a réaliser lors de la séance de TP mais ça marche pas aussi chez moi pourtant je sais bien qu'il est exécutable voila je vais vous donner le source de l'exercice de TP et aidez moi SVP, j'ai pensé que le problème est de mon système d'exploitation (Windows 7) mais avec un autre PC c'était en marche:
import java.rmi.*;
interface Sommeih extends Remote
{
public int somme() throws RemoteException;;
}
import java.rmi.RemoteException;
import java.rmi.server.ServerNotActiveException;
import java.rmi.server.UnicastRemoteObject;
public class SommeihImpl extends UnicastRemoteObject implements Sommeih
{
protected SommeihImpl() throws RemoteException
{
super();
}
public int somme() throws RemoteException
{
int a=5,b=3;
int result=a+b;
System.out.println("methode somme invoquee..."+result);
return result;
}
}
import java.rmi.*;
public class SommeihClient
{
public static void main(String[]args)
{
try
{
System.out.println("recherche de l'objet serveur...");
Sommeih somme=
(Sommeih)Naming.lookup("Sommeih");
System.out.println("invocation de la methode sayHello...");
int result=somme.somme();
System.out.println("affichage de resultat :");
System.out.println(result);
System.exit(0);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
import java.rmi.Naming;
public class SommeihServer
{
public static void main (String []args)
{
try
{
System.out.println("creation de l'objetserveur...");
Sommeih somme=new SommeihImpl();
System.out.println("referencement dans le RMIRegistry...");
//Naming.rebind("rmi://server/Sommeih",somme);
Naming.rebind("//localhost/Sommeih",somme);
//System.out.println(java.net.InetAdress.);
//Naming.rebind("Sommeih",somme);
System.out.println("attente d'invocations -CTRL-C pour stopper");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
A voir également:
- Java rmi
- Jeux java itel touche - Télécharger - Jeux vidéo
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux gratuits sur mobile ✓ - Forum Logiciels
- Java apk - Télécharger - Langages
- Jeux java itel 5360 - Forum Mobile