Bonjour,
Voulant transmettre à un client un document dom4j, j'utilise une pile qui contiendra ce document.
La pile est :
Son implémentation est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 public interface Pile extends java.rmi.Remote { Document hautDocument() throws java.rmi.RemoteException; void empilerDocument(Document object) throws java.rmi.RemoteException; } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 public class PileImpl extends UnicastRemoteObject implements Pile { private int max; private int nb; private Object [] tab; private Document [] document; public PileImpl (int m) throws java.rmi.RemoteException { max = m; tab = new Object[max]; nb = 0; document = new Document[max]; } public void empilerDocument(Document object) throws java.rmi.RemoteException { if (nb==max-1) throw new java.rmi.RemoteException("Pile pleine !"); document[nb]=object; nb++; } public Document hautDocument() throws java.rmi.RemoteException { if (nb==0) throw new java.rmi.RemoteException("Pile vide !"); return document[nb-1]; } }
Le serveur met en ligne la pile qui contient le Document dom4j à l'aide de la méthode empilerDocument.
Le client peut récupérer la pile avec un lookup.
Il y a cependant une erreur lorsqu'il prend le document dans la pile (avec la méthode hautDocument)...
L'exception est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.EOFException at sun.rmi.server.UnicastRef.invoke(Unknown Source) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source) at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source) at com.sun.proxy.$Proxy0.hautDocument(Unknown Source) at klee.kada.start.Start_log.main(Start_log.java:41)
Etant débutant, n'arrivant pas à résoudre cette exception, preneur de toutes aides et cordialement,
Partager