Cannot set Java breakpoint in Intellij IDEA

JavaDebuggingGoogle App-EngineIntellij Idea

Java Problem Overview


I'm trying to put breakpoints into the GoogleAppEngine sources (SDK 1.7.0) but IDEA Ultimate (11.0.2) just keeps telling me Warning: No executable code found at line 482 in class com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.

I get this error message both when I run the code from unit tests and I start up the development server.

It's quite annonying. Anyway my sources are in an external (relative to both the IDEA home and the project home) directory, and my jar files are under the Appengine SDK lib dir.

My jar files are added as project library to the module, and my sources are attached to this library. I was playing around with module dependencies as well, but without any luck. Finally I decided to put this library into Compile scope, but that was a bad idea since the SDK provides these jars at runtime, so I decided to fall back to Provided scope.

I also played with the export checkbox on the module dependencies tab, but I think this is irrelevant, according to the web help, export is only important when you have dependent modules and you want to make your library available in these modules as well.

Anyway, this question arised 4 years ago also. So I'm wondering now whether is it really so hard to solve this issue?

I'm very disappointed now. I didn't have any problems with IDEA so far... I saw that this problem arised to other people as well, so this is not unique I guess.

Any help is appreciated.


I edited my question due to my javap experiments below: It seems that the classes and the sources are NOT out of sync. I checked out the 1.7.0 related revision from SVN, and I'm using the 1.7.0 SDK, so these should not be out of sync at all.

Java Solutions


Solution 1 - Java

I had similar problems and various attempts has been applied. Below is my usual steps:

  1. If you are using Maven dependencies, go to Maven Projects -> refresh
  2. If that does not work, Try top menu --> Build --> Rebuild Project
  3. If that still doesn't work, try top menu --> File --> Invalidate Cache/Restart
  4. If that still doesn't work, then $CATALINA_BASE/bin/catalina.sh stop, then start

After this, usually it covers 99% of the problems. Otherwise, Probably you will have to examine some other possibilities.

Solution 2 - Java

I had faced similar problem while debugging in intellij. I wasn't able to put breakpoint at one of the code snippet, then i changed the line number of the code and after that i was able to put breakpoint. Looks like a bug in intellij or some caching issue.

Solution 3 - Java

I found some other cases where people reported that IDEA says "No executable code found". A common pattern is that they were trying to debug code that has been built without debug information. Check that you are compiling with the "-g" flag (or equivalent) set.

Solution 4 - Java

I was able to fix this problem by recompiling the class in question: Build - > Recompile (filename.java)

Solution 5 - Java

The question is rather old but I thought my experience might help someone in the future. In my case I was trying to debug code that was not compiled with debug information. I am using maven in which the original parent pom file before modification looked something like below in the build section.

<build>
	<pluginManagement>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>2.1</version>
			<configuration>
		   	  <target>${javaCompilerVersion}</target>
			  <source>${javaCompilerVersion}</source>
			  <encoding>UTF-8</encoding>
	        </configuration>
	    </plugin>
        <!--More plugins...-->
     </pluginManagement>
</build>

I changed the above section to make it look like below.

<build>
	<pluginManagement>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>2.1</version>
			<configuration>
		   	  <target>${javaCompilerVersion}</target>
			  <source>${javaCompilerVersion}</source>
			  <encoding>UTF-8</encoding>
              <debug>true</debug>
              <debuglevel>lines,vars,source</debuglevel>
	        </configuration>
	    </plugin>
        <!--More plugins...-->
     </pluginManagement>
</build>

Note the added <debug> and <debuglevel> elements. debuglevel element can take any combination of the three arguments separated by commas.

After compiling with this change I finally managed to put break points in IDEA.

Solution 6 - Java

The essence of the problem is that the JVM executes a class file (either simple class or a class loaded from jar from the class path) which DOES NOT MATCH the source being used by debugger. Once this is understood, the solution is simple: make sure that the source represents the class being executed. So, to fix the problem you can refresh-synchronize sources to classes, etc.

Solution 7 - Java

I had same issue. I don't know why, but for me helped to add any modification in code, such as adding or removing comment. Strange, but it resolved my issue

Solution 8 - Java

Menu --> File --> Invalidate Cache/Restart

This worked for me under IntelliJ 13.0.2

Solution 9 - Java

I had a similar problem and it was caused by a mistake in my Tomcat configuration, under the Deployment tab, the "Deploy at the server startup". I had accidentally changed it to a very similar project with ":war exploded". When I changed it back, it worked fine.

Solution 10 - Java

Had same issue, figured out that the version of code on the server and the one I'm debugging are different. After synching the code the issue was resolved.

Solution 11 - Java

In my case i was debugging remotely, found out that the version of code on the remote server and Intellij was not in sync. I re-build the latest code locally, placed the same change on remote server and it worked for me.
You can try out few more possible solutions that could be specific to your problems suggested by JetBrains. Impossible to debug "Warning: no executable code found at line."

Solution 12 - Java

Please, make sure you have not run Proguard. It helped me.

Solution 13 - Java

If you are using some servers they will go into "low memory mode", that means they will not debug for you, no matter what options or caches you invalidate.

You should stop your server, increase the memory settings on the options that are passed to java and restart your server. Check logs to ensure you don't get a report such as "running in low memory mode".

Solution 14 - Java

In my case I killed all running processes on the device and disconnected and reconnected it.

Solution 15 - Java

I had the same issue using debug configuration in my case Tomcat. I tried all above, but nothing. when I just reconfigured the Tomcat (debug > edit configuration > remove the tomcat > add it again from scratch) it was finally working :)

Solution 16 - Java

Check your disc space and free up some memory. If you are running low on disc space, even if your server is not on "low memory mode", intelliJ would not allocate the space to cache the classes required for debugging. As a result it won't allow you to set the break-point.

Solution 17 - Java

I was working on an Intellij Plugin and when the sandbox Intellij popped up, what finally fixed my issue was, once the sandbox intellij popped up, I rebuilt from there.

After that I built both my Intellij and the sandbox Intellij and they synced finally.

Solution 18 - Java

Simply by stopping the debugging process and reinitiating it. In my case, simple as that.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlma AlmaView Question on Stackoverflow
Solution 1 - JavaMatthew ChenView Answer on Stackoverflow
Solution 2 - Javavaibhav.gView Answer on Stackoverflow
Solution 3 - JavaStephen CView Answer on Stackoverflow
Solution 4 - JavareubotView Answer on Stackoverflow
Solution 5 - JavaWillaView Answer on Stackoverflow
Solution 6 - JavaJosephView Answer on Stackoverflow
Solution 7 - JavaDmitrii SkomorokhovView Answer on Stackoverflow
Solution 8 - JavaRahul ChintakuntaView Answer on Stackoverflow
Solution 9 - JavakiwiView Answer on Stackoverflow
Solution 10 - JavarakaView Answer on Stackoverflow
Solution 11 - JavaAnshu ShekharView Answer on Stackoverflow
Solution 12 - JavaAlexey TaranView Answer on Stackoverflow
Solution 13 - JavaPeterSView Answer on Stackoverflow
Solution 14 - JavaVic ToriousView Answer on Stackoverflow
Solution 15 - Javaeldad marcianoView Answer on Stackoverflow
Solution 16 - JavaVaishali KulkarniView Answer on Stackoverflow
Solution 17 - JavaGodrules500View Answer on Stackoverflow
Solution 18 - JavaIván YoedView Answer on Stackoverflow