Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hot code swap is not working, why?

When I'm trying to write a simple one class console app - there is no problem. I can change code in a method when debugging.

The problem is with my web apps on Jetty. It's not working nor just in usual debug mode(pressing a debug button in eclipse) nor in remote debug mode described here. I can debug but can't change even usual not static methods, like adding sysout for example, I mean I can change it but after saving it's not updated and it works the same as before.

Also, I talked to my colleagues, it works for them but they use Spring Tool Suite version of eclipse, I tried and concluded that it works in the latest version STS out of the box in usual debug mode and it doesn't work in the latest version of Eclipse.

What can be a reason?

like image 641
MaxNevermind Avatar asked Oct 02 '22 11:10

MaxNevermind


People also ask

How do I enable HotSwap in Intellij?

Recompilation happens automatically if the Build project before reloading classes option is enabled in Settings/Preferences | Build, Execution, Deployment | Debugger | HotSwap. If this option is disabled, you need to recompile the files before reloading (Build | Recompile Ctrl+Shift+F9 ).

What is hot code swap?

Hot code swapping is replacing or adding components without stopping or shutting down the system. It is frequently called as hot plugging. In software development, hot swapping is used to upgrade or update the system without interrupting the current running system.

What is JVM hot swapping?

All it means is that you can make certain changes to your code while in the middle of a debugging session, and have those changes take effect immediately, without having to restart the application.

What is hot code replace in eclipse?

Hot code replace (HCR) is a debugging technique whereby the Eclipse Java debugger transmits new class files over the debugging channel to another JVM. In the case of Eclipse development, this also applies to the VM that runs the runtime workbench.


2 Answers

Answer based on my comments to the question (as suggested by OP):

Strange Eclipse behaviour can happen when your workspace or project metadata are corrupted. This can happen for example when you upgrade Eclipse version and use workspace created by the old version.

You should try to re-create your workspace and setup fresh project checkout. If the problem goes away, you know there was something fishy in the workspace metadata.

like image 186
Pavel Horal Avatar answered Oct 04 '22 01:10

Pavel Horal


You would have to use hot swap proxy for swapping classes in EE container like jRebel. Check it out.

like image 41
Antoniossss Avatar answered Oct 04 '22 01:10

Antoniossss