title: How to solve the "Exception in thread "Thread-1" java.lang.StackOverflowError" ? in my Application
body: <p>In my application i am accessing data from another system Database through ip address communication.</p>
  
  <p>So for that,if database system is offline at that time exception is occur during connection so in catch block again i am calling run() method ,when it come to online normal flow of application execution happen. but in this process i am getting "Exception in thread "Thread-1" java.lang.StackOverflowError" this exception how to solve this exception in my scenario.</p>
  
  <p>This is my code:</p>
  
  <pre><code>MAIN CLASS :-
  
  public static void main(String args[]) {
      java.awt.EventQueue.invokeLater(new Runnable() {
          public void run() {
              new LsduJFrame().setVisible(true);
  
          }
      });
   new Thread(new DisplayPlazaNameLocation()).start();// i am calling here
  }
  
  DisplayPlazaNameLocation:-
  
  public class DisplayPlazaNameLocation implements Runnable{
  static String plazaNameLocation;
  static Connection con;
  int i =0;
  public  void getPlazaNameLocation(){
      try {
          System.out.println("in getPlazaNameLocation()==============================================");
          PreparedStatement pst=con.prepareStatement("SELECT DISTINCT Plaza_Loc FROM lsdu_live");
          ResultSet rs = pst.executeQuery();
          while(rs.next()){
              plazaNameLocation = rs.getString("Plaza_Loc");
              //System.out.println(plazaNameLocation);
          }
  
          String ar[] = plazaNameLocation.split(",");
          jLabel199.setText("&lt;html&gt;"+ar[0]+"&lt;br&gt;"+ar[1]+"&lt;/html&gt;");
          rs.close();
          pst.close();
          con.close();
  
      } catch (SQLException ex) {
  
          run();
       }
  }
   @Override
  public void run(){
      try {
          Class.forName(DB_DRIVER_CLASS);
          con= DriverManager.getConnection(DB_URL[0],DB_USERNAME,DB_PASSWORD);
         if(con != null){
          this.getPlazaNameLocation();}
      } catch (ClassNotFoundException ex) {
           run();
      } catch (SQLException ex) {
          run();
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>After executing some time I am getting this exception <code>Exception in thread "Thread-1" java.lang.StackOverflowError</code></p>
  
  <p>suppose when i resolve the Connection issue before getting this Exception the application working fine, but after getting this exception, no use of resolve after getting this exception at that time i need close the application and open again at that time it's working. <code>How to resolve this issue with respect to my code ?</code></p>
  
  <pre><code>stackTrace() data:-
  
  Exception in thread "Thread-1" java.lang.StackOverflowError
  at java.lang.Exception.&lt;init&gt;(Exception.java:66)
  at java.sql.SQLException.&lt;init&gt;(SQLException.java:70)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:435)
  at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
  at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
  at java.sql.DriverManager.getConnection(DriverManager.java:571)
  at java.sql.DriverManager.getConnection(DriverManager.java:215)
  at lsdu_application.DisplayPlazaNameLocation.run(DisplayPlazaNameLocation.java:47)
  at lsdu_application.DisplayPlazaNameLocation.run(DisplayPlazaNameLocation.java:59)
  at 
  </code></pre>