When you are debugging in Eclipse, sometimes when you debug into a method, you will meet with “Source not found” message, for example below.

/wp-content/uploads/2016/08/clipboard1_1013211.png

/wp-content/uploads/2016/08/clipboard2_1013212.png

In my example, this is because the corresponding source code for AbstractTypeHierarchyTraversingFilter does not exist in local workspace. The source code could not be automatically downloaded via “Maven -> Download Sources”.


[Note] This very issue in this example could also be resolved by changing dependency configuration in pom.xml. Please read this blog about what exactly should be defined in pom.xml if different Spring component is planned to be used in your application. In my example, after I add the missing dependency “spring-core” in pom.xml and re-download source via Maven plugin, the source code is then visible in debugger.

/wp-content/uploads/2016/08/clipboard4_1013220.png

Solution

1. Google with keyword as below:

/wp-content/uploads/2016/08/clipboard5_1013221.png

Click the first hit web page.

2. Go to the corresponding download page for your spring framework version:

/wp-content/uploads/2016/08/clipboard6_1013222.png

You could find your Spring version in pom.xml, dependency block:

/wp-content/uploads/2016/08/clipboard7_1013223.png

3. Download the .java source file.

Create a series of nested folders whose hierarchy exactly match the package declaration in java file. In my example, the folder structure should look like below:

/wp-content/uploads/2016/08/clipboard8_1013224.png

/wp-content/uploads/2016/08/clipboard9_1013225.png

Then make a zip file based on this folder.

4. Click “Change Attached Source…” to load the zip file created in step3.

/wp-content/uploads/2016/08/clipboard10_1013226.png

/wp-content/uploads/2016/08/clipboard11_1013227.png


After that the source code of AbstractTypeHierarchyTraversingFilter is visible in debugger now.

/wp-content/uploads/2016/08/clipboard12_1013228.png

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply