Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is the modified code to make it working. Thanks to EJP for the solution.</p> <p><strong>ServiceApp.java</strong></p> <pre><code>import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; public class ServiceApp { public static RMIService rmiService; public static Registry registry; public static void main(String[] args) { System.out.println("Starting RMI server"); { try { rmiService = new RMIService(); registry = LocateRegistry.createRegistry(1099); registry.rebind("RMIServer", rmiService); System.out.println("RMI server running"); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } </code></pre> <p><strong>RMIService.java</strong></p> <pre><code>import java.rmi.RMISecurityManager; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; public class RMIService extends UnicastRemoteObject implements IRemoteServerService { private static final long serialVersionUID = 1L; public RMIService() throws RemoteException { super(); // Install a security manager. System.setSecurityManager(new RMISecurityManager()); } public String pingTest() { return "Server says hi"; } @Override public boolean resetService() throws RemoteException { // TODO Auto-generated method stub return false; } </code></pre> <p>}</p> <p><strong>IRemoteServerService</strong></p> <pre><code>import java.rmi.Remote; import java.rmi.RemoteException; public interface IRemoteServerService extends Remote { boolean resetService() throws RemoteException; String pingTest() throws RemoteException; </code></pre> <p>}</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload