title: Debugger output in NetBeans
body: <p>I want to change from Visual Studio (C#) to NetBeans (Java) but the problem described below bothers me (debugger output not showing line in user code where interrupt occur).</p>
  <p>(corrected version of the question)</p>
  <p>I'm using Java with <strong>NetBeans</strong> v8.2, <strong>Apache Tomcat</strong> v9 (JSP) and <strong>PostgreSQL</strong> v9.5 (postgresql-42.2.5.jar library) and no other additions like eg. Spring Framework, Maven etc. In NetBeans I define breakpoints that are supposed to auto-attach when an exception occurs, such as Visual Studio natively does. In NetBeans you have to set such exception  by yourself giving a exception class name in Breakpoints window (as you know). Most of these defined exceptions does properly stop execution and show code line where <strong>unexpected</strong> problem occurs and you can view variable states etc (as you know). Usually defining of Throwable (as exception class name) works fine for me with most Java code but I had to define a few others when Throwable didn't work.</p>
  <p><a href="https://i.stack.imgur.com/XtdrX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XtdrX.png" alt="enter image description here" /></a></p>
  <p>Above exceptions works fine but <strong>org.postgresql.util.PSQLException</strong> doesn't (!)</p>
  <p>(I'm using above PSQLException with some exclusions - libraries where the exception is not intended to break: &quot;java.<em>, sun.</em>, javax.<em>, com.sun.</em>, jdk.<em>, org.apache.</em>, org.springframework.<em>, org.eclipse.</em>&quot; - I want interruption only in my code)</p>
  <p>Below I show what is happening.</p>
  <p>I have a PostgreSQL connection:</p>
  <pre><code>Connection conn = DriverManager.getConnection(
          cs.getPgUrlJdbc(), cs.getUser(), String.valueOf(cs.getPassword()));
  Statement cmd = conn.createStatement();
  // This is the step where error occurs because of bad schema name
  ResultSet result = cmd.executeQuery(“select * from zinformation_schema.columns”);
  </code></pre>
  <p>The above query references a nonexistent table (actually schema). When it ocuurs the IDE does not signal (there is no flickering of the icon on the systray as it does in the case of a manually set breakpoint). So you have to be observant, which is a problem in itself (keep checking the IDE continuously and look if there is something going on?).</p>
  <p>(Yes, the IDE colors the line corresponding to interruption place purple, but you have to find it yourself by browsing through the files. Even if you find it, you can't see the state of the variables. You can even then insert a breakpoint manually, but it doesn't change the fact that you always have to first figure out that the program has stopped and carry out annoying searches for the breakpoint.)</p>
  <p>The following output appears in the <strong>Debugger Console</strong> window:</p>
  <p><em>Exception org.postgresql.util.PSQLException(&lt;Current thread can not invoke methods.</em></p>
  <p><em>Probably was not suspended by an event (breakpoint, step, etc.).&gt;) breakpoint hit in org.postgresql.core.ResultHandlerBase at line 63 by thread http-nio-8080-exec-156.</em></p>
  <p><strong>(was not suspended by a breakpoint!)</strong> The above text was repeated a second time and then:</p>
  <p><em>Thread http-nio-8080-exec-156 stopped at ResultHandlerBase.java:63.</em></p>
  <p>None of the files mentioned above are mine but PostgreSQL's, of course.
  So I push <strong>Step Over</strong> and the window <strong>Debugger Console</strong> shows also:</p>
  <p><em>User program running</em></p>
  <p>Exception org.postgresql.util.PSQLException(&quot;ERROR: relation &quot;zinformation_schema.columns&quot; does not exist*</p>
  <p><em>Position: 15&quot;) breakpoint hit in org.postgresql.core.v3.QueryExecutorImpl at line 380 by thread http-nio-8080-exec-156.</em></p>
  <p>above written 2 times (as usual) and then:</p>
  <p><em>Thread http-nio-8080-exec-156 stopped at QueryExecutorImpl.java:380.</em></p>
  <p>Again, I have no information about the source of the problem <strong>in my code</strong>, it only shows what is happening in the PostgreSQL's library.
  The text &quot;<em>relation zinformation_schema.columns does not exist</em>&quot; could be a clue which I could find using <strong>Find in Files</strong> but if the name of the table was e.g. given by the user or comes from an external source (from a file, from a database etc) each time it would require an analysis of the entire program whenever.</p>
  <p>I am doing <strong>Step Over</strong> for the second time:</p>
  <p><em>User program running</em></p>
  <p><em>Thread http-nio-8080-exec-156 stopped at PgStatement.java:444.</em></p>
  <p>Something new, but I still don't know a place in my code that I need to improve, and I'm slowly getting discouraged.</p>
  <p>The <strong>Apache Tomcat or TomEE Log</strong> and <strong>Apache Tomcat or TomEE</strong> consoles remain silent.
  Further pushing the <strong>Step Over</strong> does not bring anything new, except that the message shows a different line number in the PgStatement.java file (PostgreSQL's library) with each move (probably irrelevant?):</p>
  <p><em>User program running</em></p>
  <p><em>Thread http-nio-8080-exec-156 stopped at PgStatement.java:444.</em></p>
  <p><em>User program running</em></p>
  <p><em>Thread http-nio-8080-exec-156 stopped at PgStatement.java:366.</em></p>
  <p><em>User program running</em></p>
  <p><em>Thread http-nio-8080-exec-156 stopped at PgStatement.java:368.</em></p>
  <p><em>User program running</em></p>
  <p><em>Thread http-nio-8080-exec-156 stopped at PgStatement.java:369.</em></p>