开发者

Eclipse Debug: Source Not Found while remote debugging

开发者 https://www.devze.com 2023-04-11 20:28 出处:网络
In my Java eclipse project, while I am remote debugging, eclipse does not step into the class files ofimported library files even though the source file jars are properly mapped to the library files.

In my Java eclipse project, while I am remote debugging, eclipse does not step into the class files of imported library files even though the source file jars are properly mapped to the library files.

Instead it gives me a "Source Not Found" error. But when I am editing t开发者_开发知识库he same class in eclipse, I can control-click a class or method name and it takes me to the correct library class file.

Can anyone please tell me what I am doing wrong?

I am using Tomcat 6 and latest Eclipse Java EE.


In this scenario just follow the following steps:

  1. Go to Run → Debug Configurations
  2. Select the remote application configuration being debugged.
  3. Select the second tab named 'Source'
  4. Now add the folder/projects containing the source code explicitly here.


In the Java build path for the project, under the sources tab, check if your class path is under the included list. If its under the excluded list, remove it from there.


As Saury said, get your debug configuration right. When remote debugging, often developers have selected the wrong project while creating a new configuration. Verify you select the project you wish to debug and it corresponds to the version of the deployed WAR/EAR/JAR in the appliation container.


I faced same issue and got solved by below steps in eclipse.

  1. Go to Severs tab in your Eclipse tab
  2. Right click on the server and click on Add and Remove Projects
  3. Select/add the project EAR which you want to debug
  4. After finish - Start your server in debug mode

Should solve with above steps as it resolved for me:)


I ran into a similar problem. It turns out I was missing the devel package on CentOS.

In my particular case, the following yum statement solved the problem.

yum install java-1.7.0-openjdk-devel


Follow the next steps in case you use a parent project connected to sub-project/s:

Use the 'Debug Cofigurations' source tab or the 'Edit Source LookUp path' option to attach the sources of the running code.

Note: you'll need to attach the src folder of your inner project rather than the target in order to make it work (check the screenshot below).

E.g.

Eclipse Debug: Source Not Found while remote debugging

An update for eclipse Oxygen (Feb 2018):

Attaching the Java projects (sub projects) also worked well; e.g:

Eclipse Debug: Source Not Found while remote debugging


Check under "Debug Configurations" -> "Remote Java Application" -> Tab "Connect" -> "Project" that you chose the correct project.


Here is how it worked for me. Did this on Eclipse oxygen

  1. Go to debug configurations and then the source tab
  2. Click on Add
  3. Select Java Library. Hit ok
  4. The select Web app libraries and click next
  5. In the next screen select the project/application that you are debugging.
  6. Click Finish

This worked for me like a charm


Using Eclipse version Oxygen.2 (2017), the accepted answer did not work for me. The following procedure was successful.

  1. Launch the application to debug with the Xdebug and Xrunjdwp switches.

    cd "C:\Program Files\Test_742\Test 7.4" test_app.exe -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8500

  2. Create a new workspace in Eclipse.

  3. Create a new Java project using File -> New -> Java Project.

  4. Copy the source code of the Jar to debug to the src folder of the new project. I found it necessary to ensure that I copied the complete folder hierarchy of the source code to my source folder.

    For me that meant copying \com\test... to my src folder.

    This puts all the source code in the build path.

  5. Copy any dependency JARs to the project. I created a new folder named myJARs.

  6. Refresh Package Explorer to see the new myJARs folder.

  7. Add the dependency JARs to the build path by opening File -> Properties -> Java Build Path -> Libraries (tab), and click Add JARs...

    Add each dependency JAR to the list, then click Apply and Close. This adds the JARs to Referenced Libraries.

  8. Configure a debug session. Click Run -> Debug Configurations -> Remote Java Application. I set Connection Type = Standard.

    Configure Host to point to the machine running the JAR and Port to the port specified in the address portion of the command line switches (8500 in my example).

  9. Notice that on the Source tab, both the source files and the dependency JARs are present.

  10. Click Apply, then Debug.

  11. View the debugging perspective by clicking Window -> Perspective -> Open Perspective -> Debug.

  12. Place breakpoints in the source code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号