Modern Java Application Debugger
To debug Java applications undergoing modernization (e.g., migrating from legacy systems to Spring Boot and Angular), follow this structured process:
Debugging Process
- •
Check dependency conflicts first
- •Use
run_in_terminalto executemvn dependency:tree(Maven) orgradle dependencies --scan(Gradle) - •Look for version conflicts between legacy and updated libraries
- •Check for duplicate dependencies with different versions
- •Pay special attention to Spring Boot BOM (Bill of Materials) overrides
- •Use
- •
Verify Java version compatibility
- •Check
pom.xmlorbuild.gradleforjava.version,maven.compiler.source, orsourceCompatibility - •Ensure the runtime Java version matches or exceeds the compile target
- •Use
run_in_terminalto verify withjava -versionandmvn -versionorgradle -version - •Watch for features that require specific Java versions (e.g., records require Java 16+)
- •Check
- •
Enable verbose build logging
- •For Maven: Add
-Xflag (e.g.,mvn clean install -X) - •For Gradle: Add
--debugor--stacktraceflag - •Use verbose output to identify the exact point of failure
- •For Maven: Add
- •
Check for deprecated API usage
- •Look for calls to removed or deprecated Java APIs (common in Java 8 → 11+ migrations)
- •Search for removed packages:
javax.*→jakarta.*(Java EE → Jakarta EE) - •Check for removed JDK internals (e.g.,
sun.*packages)
- •
Review build tool migration issues
- •Verify plugin versions are compatible with the new Java version
- •Check Maven/Gradle wrapper versions (
mvnworgradlew) - •Ensure parent POM or dependency management sections are correctly configured
- •
Inspect module system conflicts
- •Check for reflection-based code that may break with Java 9+ module system
- •Look for
IllegalAccessErrororInaccessibleObjectException - •Add necessary
--add-opensor--add-exportsJVM flags if required
- •
Verify environment configuration
- •Check that
JAVA_HOMEpoints to the correct JDK version - •Verify system properties and environment variables are set correctly
- •Review application.properties or application.yml for configuration issues
- •Check that
- •
Analyze runtime errors
- •Read stack traces carefully for
ClassNotFoundException,NoSuchMethodError, orNoClassDefFoundError - •These often indicate dependency version mismatches or missing transitive dependencies
- •Use dependency analysis tools to find the source
- •Read stack traces carefully for
Common Migration Issues
- •Spring Boot 2 → 3: Requires Java 17+, Jakarta EE namespace changes, removed properties
- •Java 8 → 11+: Removed modules (JAXB, JAX-WS), different garbage collectors
- •Hibernate 5 → 6: Breaking API changes, different query behaviors
- •JUnit 4 → 5: Different annotations (
@Test,@Before,@After)