Newsgroup: it.comp.java
Titolo: Aiuto RMI

Ciao ragazzi,
sto scrivendo dei priccoli programmi per studiare l'architettura RMI.
In particolare, ho scritto un server RMI con Pettern Factory, che mette a
disposione un metodo che esegue una semplice somma tra due interi.
Sia il server che il client funzionano perfettamente.
A questo punto ho voluto implementare una versione GUI (con Swing) del
client, ma in fase di compilazione ottendo delle eccezioni che non so
spiegarmi, riporto l'esempio e gli errori in questione. Qualcuno saprebbe
darmi qualche indicazione?
package netinventions;
import java.rmi.*;
import java.rmi.registry.*;
public class MyRMIClientGUI extends javax.swing.JFrame {
    private SommaRemota smRemota;
    private String stringa;
    /** Creates new form RMIClientGUI */
    public MyRMIClientGUI() throws Exception{
        initComponents();
    }
    public void istanzaRMI() throws Exception{
        SommaRemotaInterfacciaFactory server =
(SommaRemotaInterfacciaFactory)
Naming.lookup("//pegaso:2003/MyServerFactory");
        smRemota = (SommaRemota) server.getSommaRemota();
    }
    public String calcola() throws Exception{
        return (Integer.toString(smRemota.Somma(10,15)));
    }
     private void initComponents() throws Exception{
        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
        setTitle("Client RMI Version 0.0");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });
        jLabel1.setText("Introdurre il parametro A");
        getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, 150, -1));
        getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(170, 30, 60, -1));
        jLabel2.setText("Introdurre il parametro B");
        getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 150, -1));
        getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(170, 70, 60, -1));
        jLabel3.setText("Risultato da server");
        getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 130, 150, -1));
        getContentPane().add(jTextField3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(170, 130, 60, -1));
        jButton1.setLabel("Esegui");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });
        getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(20, 200, -1, -1));
        pack();
    }
    private void jButton1MousePressed(java.awt.event.MouseEvent evt) throws
Exception{
        stringa = calcola();
        jTextField3.setText(stringa);
    }
    private void exitForm(java.awt.event.WindowEvent evt) throws Exception{
        System.exit(0);
    }
    public static void main(String args[]) throws Exception{
        new RMIClientGUI().show();
    }
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JButton jButton1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField1;
}
EERORI OTTENUTI:
netinventions/MyRMIClientGUI.java [50:1] unreported exception
java.lang.Exception; must be caught or declared to be thrown
                exitForm(evt);
                ^
netinventions/MyRMIClientGUI.java [72:1] unreported exception
java.lang.Exception; must be caught or declared to be thrown
                jButton1MousePressed(evt);
                ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -deprecation for details.
2 errors
Errors compiling MyRMIClientGUI.
Ciao e grazie
Mr. Deckard

 ha scritto nel messaggio
news:dL_ea.140004$zo2.3...@news2.tin.it...
