Java17 / Tomcat: Hot swap failed ... but I didn't change class structure

Answered

I recently modernized a project and switched from JDK 8 to 17. Although I'm not sure if this is really the root cause, as I didn't use Hot Swap for quite a while.

Now, I'm getting 

Hot Swap failed

Tomcat: changes to class attribute not implemented

Tomcat: Operation not supported by VM

for even the tiniest change in the source code, e.g. changing a condition in a return statement from logical or || to logical and &&.

If I change the code back and rebuild again (just for the sake of the experiment), it says All classes are up to date. Nothing to reload. This means that the connection to the JVM seems to work, and also the check for changes in the classes.

 

Any ideas?

0
11 comments

Hello,

Please share logs folder zipped ("Help | Show Log in…") after reproducing the issue. You may share files via https://uploads.jetbrains.com/ form.

0

Interestingly, the message has changed. Now, I'm getting “0 classes reloaded” after changing a line of code like this:

new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message);

to

new FacesMessage(FacesMessage.SEVERITY_WARN, message, message);

and then clicking on the “hammer” icon.

 

Log is here: Upload id: 2023_09_01_23NZ9ko6fDs4pnTUBgLGUN (file: idea.log)

 

 

0

Thanks Markus.

Would it be possible to also share the project? You can upload it to https://uploads.jetbrains.com and provide the upload id here.

Otherwise, please provide:

  • A screenshot of the run configuration used to run the debug: Run | Edit Configurations
  • Screenshots of the Tomcat run configuration → ‘Server’ tab and ‘Startup/Connection’ tab (choose "Debug")
  • A screenshot of the File | Settings | Build, Execution, Deployment | Debugger | HotSwap dialog
  • Entire output of the console where you see the “0 classes reloaded” error
0

Hi,

I've just uploaded the screenshots, Upload ID is 2023_09_07_o81gmPjyj4fm9C11UkCtcB but I'm not sure which console you mean to share the output of.

About the issue itself … I found out the difference between the two errors:

  • I did a Build|Rebuild, then started the application.
  • When it was running, I've changed a String.
  • Then, I tried just “Build” (the hammer icon) and I got “0 classes reloaded”.
  • Then, I did a Build|Rebuild again and then I got the “not supported” error.

In between, the class relaod worked one time, and afterwards it didn't anymore. So I think my configuration is not completely screwed, it must be a detail.

Sharing the project is not feasible unfortunately, but if it helps, we could do a screen-sharing session next week (except monday or wdnesday).

0

Thanks Markus.

Is the option to "Build project automatically" enabled in your project under 'File | Settings | Build, Execution, Deployment | Compiler'? Does it make a difference if you disable it?

Do you have the same problem if you switch to another JDK?

0

It's currently disabled. Generally, I only build manually.

 

0

Do you have the same problem if you switch to another JDK?

0

I didn't have it with JDK 8, and at the moment, the issue goes on and off … sometimes it works, sometimes it doesn't - all with the same little type of changes.

I'll check JDK 11, but it will take a while until I'm sure if it works reliably or also just on and off.

0

Thank you. 

If it doesn't work, I'd appreciate it if you could create a small demo project where the issue can be reproduced in your environment, and share it (entire folder). The cause of the problem is not very clear from logs and screenshots alone, and we don't do screen-sharing sessions to troubleshoot things like this I'm afraid.

0

OK, but give me some time to do that. Please don't close this threat if it takes a bit longer.

0
Don't worry Markus, the thread won't be closed. Regardless of how much time passes, I (or one my colleagues) will be notified as soon as there is an update in it. 

So you can take your time preparing the project as it will be a huge help with the investigation.
0

Please sign in to leave a comment.