7

I'm trying to set up the spring source code in an eclipse project so that I can step through it with the debugger.

Currently, the specific line of code I'm trying to step into is this one:

ApplicationContext context=new ClassPathXmlApplicationContext("classpath:spring.xml");

ApplicationContext and ClassPathXmlApplicationContext are part of org.springframework.context:

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

Under "Java Build Path"=>"Libraries", I've specified the path to the file org.springframework.context-sources-3.1.3.RELEASE.jar for org.springframework.context-3.1.3.RELEASE.jar.

enter image description here

I'm using spring 3.1.3 with eclipse indigo 3.7.2.

Update:

I tried adding the sources.jar files to the source tab under "Debug Configurations" but eclipse is still not finding the source.

enter image description here

opike
  • 7,053
  • 14
  • 68
  • 95

2 Answers2

1

Try below:

Menu Option Run -> Debug Configurations -> Java Application 
   Provide required inputs in "main" tab
   Add source jar file in source tab

Press OK and run this newly created option to debug.

If running remote, then select Remote Java Application in debug configuration's left pane.

Yogendra Singh
  • 33,927
  • 6
  • 63
  • 73
  • Hi I tried your suggestion but to no avail. I updated the original question with another screenshot. – opike Nov 11 '12 at 20:56
  • @opike: Can you please share me the screen where it show, no source attached? – Yogendra Singh Nov 11 '12 at 20:59
  • it actually is finding the spring source code now. When I first step inside the call, it says source not found for the classloader file, but they eventually it does make inside the spring source code. – opike Nov 11 '12 at 22:39
0

When working with maintaining a very old system I found that a specific jar file containing sources had to be downloaded for debugging purposes. http://central.maven.org/maven2/org/springframework/batch/spring-batch-core/{release number}. And as mentioned in the answer above add that jar to the source tab for the Debug Configuration

Cummings
  • 128
  • 2
  • 13