0

I am executing a code that does some database operations.

It performs well when I execute it using the Run command in Eclipse.

But when I execute it in debug mode, I get the source not found

The JAR file mysql-connector-java-5.1.39-bin.jar has no source attachment

dimo414
  • 47,227
  • 18
  • 148
  • 244
Josephine
  • 77
  • 2
  • 11

3 Answers3

1

You're trying to step into code provided by mysql-connector-java, and you haven't linked in an source code for Eclipse to actually step-in-to.

The easiest thing to do would be to step over that line (since you probably don't care about it) rather than trying to debug the connector code. You may also want to tweak your debugger settings to prevent exceptions from pausing your execution.

As @nitind points out you can also filter types, packages, and patterns so the debugger avoids stepping through them.

If that doesn't work or you do need to step into the connector code you'll need to download a source jar (from Maven) and attach it in your project's build configuration.

Community
  • 1
  • 1
dimo414
  • 47,227
  • 18
  • 148
  • 244
  • I keep running into such situations... I downloaded a class decompiler plugin... No I don't care about source codes :P – Jay Nov 29 '16 at 18:26
  • @dimo414 But then wouldn't the code require the source file during execution using the Run command? Where does it fetch the source code for mysql-connector then? – Josephine Nov 29 '16 at 18:29
  • No, you already have the *binary* jar installed, but it doesn't contain any source code. Projects often distribute separate binary and source jars rather than one much larger jar containing both to reduce file sizes. – dimo414 Nov 29 '16 at 18:30
  • To clarify a little more, it only wants the source when debugging specifically to *show* it to you as you step through it. You can have it just not bother trying to step into those classes by enabling and listing them among your `Step Filters` on the **Step Filtering** preference page. http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fdebug%2Fref-step_filtering.htm – nitind Nov 29 '16 at 19:17
0

This is happening because the debugger is running into some class file...

To view this, either download the source code and attach it or install some class decompiler plugin (I am using JAD Eclipse Plugin). The first solution is better.

Jay
  • 1,089
  • 12
  • 29
0

Debugging in eclipse program works with the class actually loaded.

The problem you posted looks like the class you are using was not found in the project, but is present without debug info in a distribution jar.

This can be solved most likely by altering the build path of the project to stop using this jar and have the JVM using the project.

or you can try mvn clean eclipse:eclipse

Brij
  • 259
  • 2
  • 8