ListView上的JavaFX RemoteException?

时间:2018-05-19 20:09:21

标签: java listview exception javafx remoteexception

我有一个JFXButtons的JFXListView。用于正常工作的代码。我不知道发生了什么,但是当点击JFXListView的JFXButton时我得到以下异常:

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
        java.rmi.ConnectException: Connection refused to host: 192.168.1.2; nested exception is: 
        java.net.ConnectException: Connection refused: connect
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:393)
        at sun.rmi.transport.Transport$1.run(Transport.java:200)
        at sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
        at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
        at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
        at com.sun.proxy.$Proxy7.paramService(Unknown Source)
        at javafxcyberwind.UtilisateurController.lambda$getServices$13(UtilisateurController.java:164)
        at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
        at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
        at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
        at javafx.event.Event.fireEvent(Event.java:198)
        at javafx.scene.Node.fireEvent(Node.java:8413)
        at javafx.scene.control.Button.fire(Button.java:185)
        at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
        at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
        at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
        at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
        at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
        at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
        at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
        at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
        at javafx.event.Event.fireEvent(Event.java:198)
        at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
        at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
        at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
        at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
        at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
        at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
        at com.sun.glass.ui.View.notifyMouse(View.java:937)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.1.2; nested exception is: 
        java.net.ConnectException: Connection refused: connect
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:338)
        at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:112)
        at java.rmi.Naming.lookup(Naming.java:101)
        at javafxcyberwind.Cloud_ServeurIMPL.paramService(Cloud_ServeurIMPL.java:244)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:361)
        at sun.rmi.transport.Transport$1.run(Transport.java:200)
        at sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        ... 1 more
    Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.DualStackPlainSocketImpl.connect0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at java.net.Socket.connect(Socket.java:538)
        at java.net.Socket.<init>(Socket.java:434)
        at java.net.Socket.<init>(Socket.java:211)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
        ... 23 more

这是发生异常的控制器:

package javafxcyberwind;

import static javafxcyberwind.LoginController.R;

public class UtilisateurController implements Initializable, ControlledScreen {

    ScreensController myController;

    @FXML
    private JFXListView li_se;

    @FXML
    private StackPane st_dl;

    @FXML
    private AnchorPane pn_us, pn_li;

    @FXML
    private Rectangle rec;

    ServerSocket sv;
    private int p1, k;
    IP ip = new IP();
    File selectedFile;
    boolean t = false;
    private final String urep = "c:/Utilisateur/";

    @Override
    public void initialize(URL url, ResourceBundle rb) {
        File p = new File(urep);
        p.mkdir();
        String[] entries = p.list();
        for (String s : entries) {
            File currentFile = new File(p.getPath(), s);
            currentFile.delete();
        }
        li_se.getItems().clear();   
    }

    @FXML
    public void getServices(ActionEvent e) {
        try {
            li_se.getItems().clear();
            for (Object service : R.ListeService()) {
                JFXButton b = new JFXButton("" + service);
                b.setStyle("-fx-rippler-fill:black;-fx-text-fill:black;-fx-font-size:16px;-fx-background-color:orange;-fx-background-radius:5px;");
                b.setOnAction((ActionEvent event) -> {
                    try {
                        VBox vBox = new VBox(10);
                        JFXListView li_par = new JFXListView();
                        JFXTextField[] fields = new JFXTextField[22];
                        TextFieldEntier[] fEntiers = new TextFieldEntier[22];
                        TextFieldReel[] fRéels = new TextFieldReel[22];
                        ChoiceBox<String> choiceBox = new ChoiceBox<>();
                        choiceBox.getStylesheets().add(getClass().getResource("/choise-box.css").toExternalForm());
                        choiceBox.getItems().addAll("true", "false");
                        ArrayList<Object> tab = new ArrayList<>();
                        JFXButton folder = new JFXButton("Ouvrir le répertoire");
                        folder.setDisable(true);
                        ObservableList<String> ListParam = FXCollections.observableArrayList(R.paramService(b.getText()));
                        JFXDialogLayout content = new JFXDialogLayout();
                        content.setHeading(new Text(b.getText()));
                        content.setBody(vBox);
                        JFXDialog dialog = new JFXDialog(st_dl, content, JFXDialog.DialogTransition.CENTER);
                        k = 0;
                        ListParam.stream().map((st) -> {
                            if (st.equals("double")) {
                                fRéels[k] = new TextFieldReel();
                                fRéels[k].setPadding(new Insets(11));
                                Label lb = new Label("Argument ( Réel ) : ");
                                lb.setPadding(new Insets(7));
                                lb.setStyle("-fx-min-Width:178;-fx-text-fill:white;-fx-background-color:orange;-fx-background-radius:5px;");
                                HBox hb = new HBox(10);
                                hb.getChildren().add(lb);
                                hb.getChildren().add(fRéels[k]);
                                li_par.getItems().add(hb);
                            }
                            return st;
                        }).map((st) -> {
                            if (st.equals("java.lang.String")) {
                                fields[k] = new JFXTextField();
                                fields[k].setMinHeight(35);
                                fields[k].setMinWidth(157);
                                Label lb = new Label("Argument ( Texte ) : ");
                                lb.setMinWidth(178);
                                lb.setPadding(new Insets(7));
                                lb.setStyle("-fx-text-fill:white;-fx-background-color:orange;-fx-background-radius:5px;");
                                HBox hb = new HBox(10);
                                hb.getChildren().add(lb);
                                hb.getChildren().add(fRéels[k]);
                                li_par.getItems().add(hb);
                            }
                            return st;
                        }).map((st) -> {
                            if (st.equals("int")) {
                                fEntiers[k] = new TextFieldEntier();
                                fEntiers[k].setPadding(new Insets(11));
                                Label lb = new Label("Argument ( Entier ) : ");
                                lb.setPadding(new Insets(7));
                                lb.setStyle("-fx-min-Width:178;-fx-text-fill:white;-fx-background-color:orange;-fx-background-radius:5px;");
                                HBox hb = new HBox(10);
                                hb.getChildren().add(lb);
                                hb.getChildren().add(fEntiers[k]);
                                li_par.getItems().add(hb);
                            }
                            return st;
                        }).map((st) -> {
                            if (st.equals("boolean")) {
                                Label lb = new Label("Argument ( " + st + " ) : ");
                                lb.setMinWidth(178);
                                lb.setPadding(new Insets(7));
                                lb.setStyle("-fx-text-fill:white;-fx-background-color:orange;-fx-background-radius:5px;");
                                HBox hb = new HBox(10);
                                hb.getChildren().add(lb);
                                hb.getChildren().add(choiceBox);
                                li_par.getItems().add(hb);
                            }
                            return st;
                        }).map((st) -> {
                            if (st.equals("java.io.File")) {
                                fields[k] = new JFXTextField();
                                fields[k].setMinHeight(35);
                                fields[k].setMinWidth(157);
                                Label lb = new Label("Argument ( Fichier ) : ");
                                lb.setMinWidth(178);
                                lb.setPadding(new Insets(7));
                                lb.setStyle("-fx-text-fill:white;-fx-background-color:orange;-fx-background-radius:5px;");
                                HBox hb = new HBox(10);
                                hb.getChildren().add(lb);
                                hb.getChildren().add(fields[k]);
                                li_par.getItems().add(hb);
                                int x = k;
                                fields[k].addEventHandler(MouseEvent.MOUSE_CLICKED, (javafx.scene.input.MouseEvent e1) -> {
                                    FileChooser fc = new FileChooser();
                                    selectedFile = fc.showOpenDialog(null);
                                    if (selectedFile != null) {
                                        fields[x].setText(selectedFile.getAbsolutePath());
                                    }
                                });
                            }
                            return st;
                        }).forEachOrdered((_item) -> {
                            k++;
                        });
                        JFXButton exe = new JFXButton("Exécuter");
                        WeatherIconView weatherIcon = new WeatherIconView(WeatherIcon.CLOUD);
                        weatherIcon.setSize("30");
                        weatherIcon.setFill(Color.DODGERBLUE);
                        exe.setGraphic(weatherIcon);
                        exe.setStyle("-fx-text-fill:DODGERBLUE;-fx-background-color:white;-fx-background-radius:5px;");
                        exe.setPadding(new Insets(10));
                        JFXTextField res = new JFXTextField();
                        res.setMinWidth(150);
                        Label re = new Label("Résultat");
                        HBox hb = new HBox(10);
                        hb.getChildren().add(re);
                        hb.getChildren().add(res);
                        hb.setAlignment(Pos.CENTER_RIGHT);
                        hb.getChildren().add(folder);
                        li_par.setMaxHeight(180);
                        li_par.setMinWidth(384);
                        vBox.getChildren().add(li_par);
                        vBox.setAlignment(Pos.CENTER_RIGHT);
                        vBox.getChildren().add(exe);
                        vBox.getChildren().add(hb);
                        exe.setOnAction((ActionEvent e2) -> {
                            tab.clear();
                            try {
                                int k1 = 0;
                                for (String st : ListParam) {
                                    if (st.equals("int")) {
                                        tab.add(Integer.valueOf(fEntiers[k1].getText()));
                                    }
                                    if (st.equals("double")) {
                                        tab.add(Double.valueOf(fRéels[k1].getText()));
                                    }
                                    if (st.equals("boolean")) {
                                        tab.add(Boolean.valueOf(choiceBox.getValue()));
                                    }
                                    if (st.equals("java.lang.String")) {
                                        tab.add(fields[k1].getText());
                                    }
                                    if (st.equals("java.io.File")) {
                                        Fichier f = new Fichier(selectedFile.getName());
                                        tab.add(f);
                                        p1 = (int) ((Math.random() * (9000 - 5000)) + 5000);
                                        R.uploadToCloud(p1, selectedFile.getName());
                                        Socket s = new Socket(ip.IPserveur(), p1);
                                        ObjectOutputStream out;
                                        FileInputStream inf = new FileInputStream(new File(selectedFile.getAbsolutePath()));
                                        out = new ObjectOutputStream(s.getOutputStream());
                                        byte buf[] = new byte[1024];
                                        int n;
                                        while ((n = inf.read(buf)) != -1) {
                                            out.write(buf, 0, n);
                                        }
                                        out.close();
                                    }
                                    k1++;
                                }
                                if (R.retourService(b.getText()).equals("int") || R.retourService(b.getText()).equals("double") || R.retourService(b.getText()).equals("boolean") || R.retourService(b.getText()).equals("class java.lang.String")) {
                                    R.envoieDemande(b.getText(), "", 0, tab.toArray());
                                    res.setText("" + R.getResult());
                                }
                                if (R.retourService(b.getText()).equals("class java.io.File")) {
                                    p1 = (int) ((Math.random() * (9000 - 5000)) + 5000);
                                    LocateRegistry.createRegistry(p1);
                                    Utilisateur_MethodsPAIRIMPL U = new Utilisateur_MethodsPAIRIMPL();
                                    Naming.bind("rmi://" + InetAddress.getLocalHost().getHostAddress() + ":" + p1 + "/" + R.getEmail(), U);
                                    R.envoieDemande(b.getText(), InetAddress.getLocalHost().getHostAddress(), p1, tab.toArray());
                                    res.setText(urep + R.getResfile());
                                    folder.setDisable(false);
                                }
                            } catch (RemoteException | InvocationTargetException ex) {
                                Alert alert = new Alert(Alert.AlertType.ERROR);
                                alert.setTitle("Erreur");
                                alert.setHeaderText("Erreur");
                                alert.setContentText("Veuillez choisir une option");
                                ButtonType btn_annuler = new ButtonType("Annuler");
                                ButtonType btn_réessayer = new ButtonType("Réessayer");
                                alert.setGraphic(new ImageView("icon/erreur.png"));
                                alert.getButtonTypes().setAll(btn_réessayer, btn_annuler);
                                StringWriter sw = new StringWriter();
                                PrintWriter pw = new PrintWriter(sw);
                                ex.printStackTrace(pw);
                                TextArea area = new TextArea(sw.toString());
                                alert.getDialogPane().setExpandableContent(area);
                                Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
                                stage.getIcons().add(new Image("icon/erreur.png"));
                                Optional<ButtonType> res1 = alert.showAndWait();
                                if (res1.get() == btn_réessayer) {
                                    alert.close();
                                }
                                if (res1.get() == btn_annuler) {
                                    dialog.close();
                                    alert.close();
                                }                                
                                } catch (IOException | AlreadyBoundException ex) {
                                    Logger.getLogger(UtilisateurController.class.getName()).log(Level.SEVERE, null, ex);
                                }
                            });
                            JFXButton button = new JFXButton("Terminer " + b.getText());
                            button.setOnAction((ActionEvent evt) -> {
                                dialog.close();
                            });
                            content.setActions(button);
                            dialog.setOverlayClose(false);
                            dialog.show();
                            dialog.setOnDialogOpened((evt) -> {

                                pn_li.setDisable(true);
                                pn_us.setDisable(true);
                            });
                            dialog.setOnDialogClosed((evt) -> {
                                pn_li.setDisable(false);
                                pn_us.setDisable(false);

                            });
                            folder.setOnAction((ActionEvent evt) -> {
                                try {
                                    Desktop.getDesktop().open(new File(urep));
                                } catch (IOException ex) {
                                    Logger.getLogger(UtilisateurController.class.getName()).log(Level.SEVERE, null, ex);
                                }
                            });
                        } catch (RemoteException ex) {
                            Logger.getLogger(UtilisateurController.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    });
                    li_se.getItems().add(b);
                }
                if (!li_se.isExpanded()) {
                    li_se.setExpanded(true);
                    li_se.depthProperty().set(1);
                } 
            } catch (RemoteException ex) {
                Logger.getLogger(UtilisateurController.class.getName()).log(Level.SEVERE, null, ex);
            }
        }                                          
}

这是远程方法paramService:

@Override
    public ArrayList paramService(String service) throws RemoteException {
        ArrayList par = null;
        try {
            Connection c = DriverManager.getConnection("jdbc:mysql://192.168.1.2:3306/Cyberwind", "cloud", "");
            Statement sta = c.createStatement();
            ResultSet res = sta.executeQuery("SELECT `email`, `ip`, `port` FROM `connexion` WHERE `service` = '" + service + "' ORDER BY RAND() LIMIT 1");
            res.next();
            Participant_MethodsPAIR S = (Participant_MethodsPAIR) Naming.lookup("rmi://" + res.getString("ip") + ":" + res.getInt("port") + "/" + res.getString("email"));
            P = S.peer();
            par = P.getServiceParameterType(service);
            res.close();
        } catch (SQLException | NotBoundException | MalformedURLException ex) {                Logger.getLogger(Cloud_ServeurIMPL.class.getName()).log(Level.SEVERE, null, ex);
        }
        return par;
    }

如何删除此RemoteException?

0 个答案:

没有答案