Enabling Hot Reload in Liberty | Generated by AI

Home 2026.04

Question: How can I enable hot loading (live reload) of Java code and EAR changes in IBM WebSphere Liberty Profile when source files are modified?


Answer:

Hot reloading in IBM WebSphere Liberty (Liberty profile) is quite good compared to traditional app servers, but it depends on how you structure your deployment and development workflow. There are two levels to understand:


1. Basic Hot Reload (Class / Resource Changes)

Liberty supports automatic detection of changes in:

✅ Enable it

In your server.xml, ensure:

<applicationMonitor updateTrigger="mbean" dropinsEnabled="true"/>

Or more commonly:

<applicationMonitor updateTrigger="polled" pollingRate="500ms"/>

What happens?

⚠️ Limitation


2. Best Practice: Use Exploded EAR/WAR (Critical)

Instead of deploying:

app.ear

Use:

app.ear/
  META-INF/
  lib/
  myapp.war/
    WEB-INF/classes/

Why?

Liberty watches file system changes. If it’s a packaged EAR:

With exploded EAR:


3. Development Mode (Recommended)

Liberty has a powerful dev mode:

Use Maven:

mvn liberty:dev

Or Gradle:

gradle libertyDev

What it gives you:

👉 This is the closest to Spring Boot DevTools experience


4. EAR Change / Full Application Reload

If you modify:

Then Liberty will:

You can force reload via:

touch server.xml

or using JMX (updateTrigger="mbean")


5. IDE Integration (Very Important)

If you’re using:

IntelliJ IDEA

Eclipse


6. Advanced: Classloader Behavior

Liberty uses dynamic classloading, but:

So sometimes you must:

mvn liberty:stop
mvn liberty:start

7. Common Pitfalls (Very Important)

❌ Packaging EAR every time

→ kills hot reload

❌ Using shared libraries incorrectly

→ changes not detected

❌ Framework interference

Examples:


8. Practical Workflow (Recommended Setup)

For best developer experience:

  1. Use exploded EAR/WAR
  2. Run:

    mvn liberty:dev
    
  3. Edit Java code
  4. Let Maven auto-compile
  5. Liberty reloads instantly

9. Summary

Scenario Works? Notes
Change .class Fast reload
Change JSP/HTML Instant
Change EAR structure ⚠️ App restart
Packaged EAR Avoid
Exploded EAR Best

If you want, I can show:


Back Donate