title: RMI server shuts down on its own
body: <p>I'm writing a Java client-server application that uses RMI for communication. My problem is that for some reason, the RMI server just shuts down with no exception or error, on its own. I'm using Netbeans and I ran a profile to look at the threads.
  <img src="https://i.stack.imgur.com/v5uKd.png" alt="Server Threads"></p>
  
  <p>You can see in the attached image the point in time where the application supposedly finished executing as the end of the GC Daemon and the RMI Reaper threads. However, even after the application ended, the RMI TCP Accept-1099 thread is still running. The part that confuses me even more is that after the Information message popped up (you can see it in the screenshot) telling me that the server has stopped, the threads continue to be updated in the diagram so I tried to connect with the client again. Although it failed, I can see a new RMI thread being created (connection 18).   </p>
  
  <p>I have no idea how to debug this issue, and I can't figure out how it is possible for the application to exit when the RMI accept thread is still running.</p>
  
  <p>Update: Here is the server's main method:</p>
  
  <pre><code>/**
   * Main entry point.
   *
   * @param args the application arguments - unused.
   */
  public static void main(String[] args) {
  
      try {
          System.setProperty("java.rmi.dgc.leaseValue", "30000");
          sServerProperties = new ServerProperties();
          System.setProperty("java.rmi.server.hostname", sServerProperties.
                  getRmiServer());
          createRmiRegistry();
          ConfigCore configCore = new ConfigCore();
          ServerCore server = new ServerCore(configCore);
          LoginHandler loginHandler = new LoginHandler(server);
          sRegistry.
                  bind(Login.class.getSimpleName(), loginHandler.getRemote());
  
          Logger.log(Level.INFO, "Server ready!");
      } catch (RemoteException ex) {
          Logger.log(Level.SEVERE, "Unable to start RMI registry", ex);
      } catch (SQLException ex) {
          Logger.log(Level.SEVERE, "Unable to connect to the MySQL server",
                  ex);
          System.err.println(ex.getMessage());
      } catch (IOException ex) {
          Logger.log(Level.SEVERE, "Unable to load or write properties file",
                  ex);
          System.err.println(ex.getMessage());
      } catch (AlreadyBoundException ex) {
          Logger.log(Level.SEVERE, "RMI port already bounded", ex);
      } catch (NoSuchAlgorithmException ex) {
          Logger.log(Level.SEVERE, "Unable to digest password", ex);
      }
  }
  
  /**
   * Creates the RMI registry.
   *
   * @throws RemoteException if the RMI registry could not be created.
   */
  private static void createRmiRegistry() throws RemoteException {
      if (sRegistry == null) {
          Logger.log(Level.INFO, "Creating RMI Registry...");
          sRegistry = LocateRegistry.createRegistry(sServerProperties.
                  getRmiPort());
      }
  }
  </code></pre>