Java & JVM Errors
31 articles in this category
JVM errors love to hide behind long stack traces. The actual cause is usually in the last few frames, not the first — read bottom-up. This hub covers Java, Kotlin, Spring, Spring Boot, and the JVM build tools.
Recommended starting points:
- Java NullPointerException — the universal Java bug.
- Spring BeanCreationException — DI startup failures.
- Java ClassNotFoundException — classpath and packaging mistakes.
Java Language (27)
Fix: AWS Lambda SnapStart Not Working — Version vs Alias, Restore Hooks, and Uniqueness Bugs
How to fix Lambda SnapStart errors — feature requires published version, $LATEST not supported, restore hook for stale connections, UUID collisions after snapshot, time-based state staleness, and pricing surprises.
Fix: Java Record Not Working — Compact Constructor Error, Serialization Fails, or Cannot Extend
How to fix Java record issues — compact constructor validation, custom accessor methods, Jackson serialization, inheritance restrictions, and when to use records vs regular classes.
Fix: OpenTelemetry Not Working — Traces Not Appearing, Spans Missing, or Exporter Connection Refused
How to fix OpenTelemetry issues — SDK initialization order, auto-instrumentation setup, OTLP exporter configuration, context propagation, and missing spans in Node.js, Python, and Java.
Fix: Spring Boot Test Not Working — ApplicationContext Fails to Load, MockMvc Returns 404, or @MockBean Not Injected
How to fix Spring Boot test issues — @SpringBootTest vs test slices, MockMvc setup, @MockBean vs @Mock, test context caching, and common test configuration mistakes.
Fix: Spring Boot @Cacheable Not Working — Cache Miss Every Time or Stale Data
How to fix Spring Boot @Cacheable issues — @EnableCaching missing, self-invocation bypass, key generation, TTL configuration, cache eviction, and Caffeine vs Redis setup.
Fix: Spring Data JPA Query Not Working — @Query, Derived Methods, and N+1 Problems
How to fix Spring Data JPA query issues — JPQL vs native SQL, derived method naming, @Modifying for updates, pagination, projections, and LazyInitializationException.
Fix: Spring Boot @Transactional Not Rolling Back — Transaction Committed Despite Exception
How to fix Spring @Transactional not rolling back — checked vs unchecked exceptions, self-invocation proxy bypass, rollbackFor, transaction propagation, and nested transactions.
Fix: Hibernate LazyInitializationException — Could Not Initialize Proxy
How to fix Hibernate LazyInitializationException — loading lazy associations outside an active session, fetch join, @Transactional scope, DTO projection, and Open Session in View.
Fix: Spring Boot Failed to Configure a DataSource
How to fix 'Failed to configure a DataSource: url attribute is not specified' in Spring Boot — adding database properties, excluding DataSource auto-configuration, H2 vs production DB setup, and multi-datasource configuration.
Fix: Spring Boot "The dependencies of some of the beans in the application context form a cycle"
How to fix Spring Boot circular dependency errors — BeanCurrentlyInCreationException, refactoring to break cycles, @Lazy injection, setter injection, and @PostConstruct patterns.
Fix: Spring Security Returning 403 Forbidden Unexpectedly
How to fix Spring Security 403 Forbidden errors — CSRF token missing, incorrect security configuration, method security blocking requests, and how to debug the Spring Security filter chain.
Fix: Spring Boot Failed to Configure DataSource (DataSource Auto-Configuration Error)
How to fix Spring Boot 'Failed to configure a DataSource' errors — missing URL property, driver class not found, connection refused, and how to correctly configure datasource properties for MySQL, PostgreSQL, and H2.
Fix: Gradle Could Not Resolve Dependencies Error
How to fix Gradle's 'Could not resolve all dependencies' error caused by missing repositories, offline mode, proxy issues, version conflicts, and corrupted cache.
Fix: Java ClassCastException: class X cannot be cast to class Y
How to fix Java ClassCastException by using instanceof checks, fixing generic type erasure, resolving ClassLoader conflicts, correcting raw types, and using pattern matching in Java 16+.
Fix: Java ConcurrentModificationException
How to fix Java ConcurrentModificationException caused by modifying a collection while iterating, HashMap concurrent access, stream operations, and multi-threaded collection usage.
Fix: Java java.lang.IllegalArgumentException
How to fix Java IllegalArgumentException caused by null arguments, invalid enum values, negative numbers, wrong format strings, and Spring/Hibernate validation failures.
Fix: Java NoSuchMethodError
How to fix Java NoSuchMethodError caused by classpath conflicts, incompatible library versions, wrong dependency scope, shaded JARs, and compile vs runtime version mismatches.
Fix: Java java.lang.NullPointerException
How to fix Java NullPointerException by reading stack traces, adding null checks, using Optional, fixing uninitialized variables, avoiding null returns, handling auto-unboxing, and using static analysis annotations.
Fix: Spring BeanCreationException: Error creating bean with name
How to fix Spring BeanCreationException error creating bean caused by missing dependencies, circular references, wrong annotations, configuration errors, and constructor issues.
Fix: Java StackOverflowError – Infinite Recursion, Circular References, and Stack Size
How to fix java.lang.StackOverflowError caused by infinite recursion, circular references in toString or equals, JPA bidirectional relationships, and Spring circular dependencies.
Fix: Java UnsupportedClassVersionError: Unsupported major.minor version
How to fix Java UnsupportedClassVersionError caused by compiling with a newer JDK than the runtime, JAVA_HOME misconfiguration, and Maven/Gradle target version settings.
Fix: Maven Could Not Resolve Dependencies - Failed to Read Artifact Descriptor
How to fix Maven's 'Could not resolve dependencies' and 'Failed to read artifact descriptor' errors caused by corrupted cache, proxy settings, missing repositories, and version conflicts.
Fix: Spring Boot Web server failed to start. Port 8080 was already in use
How to fix the Spring Boot error 'Web server failed to start. Port 8080 was already in use' by killing blocking processes, changing ports, fixing IDE issues, and resolving Docker conflicts.
Fix: Spring Boot Whitelabel Error Page - This application has no explicit mapping
How to fix the Spring Boot Whitelabel Error Page caused by missing controller mappings, wrong component scan, wrong package structure, and missing Thymeleaf templates.
Fix: Gradle Build Failed – Could Not Resolve Dependencies or Compilation Error
How to fix Gradle build failures including dependency resolution errors, compilation failures, incompatible Java versions, and daemon issues.
Fix: Java OutOfMemoryError – Java Heap Space, Metaspace, and GC Overhead
How to fix Java OutOfMemoryError including heap space, Metaspace, GC overhead limit exceeded, and unable to create new native thread.
Fix: java.lang.ClassNotFoundException (Class Not Found at Runtime)
How to fix Java ClassNotFoundException at runtime by resolving missing dependencies, classpath issues, Maven/Gradle configuration, JDBC drivers, classloader problems, and Java module system errors.
Spring & Spring Boot (12)
Fix: Spring Boot Test Not Working — ApplicationContext Fails to Load, MockMvc Returns 404, or @MockBean Not Injected
How to fix Spring Boot test issues — @SpringBootTest vs test slices, MockMvc setup, @MockBean vs @Mock, test context caching, and common test configuration mistakes.
Fix: Spring Boot @Cacheable Not Working — Cache Miss Every Time or Stale Data
How to fix Spring Boot @Cacheable issues — @EnableCaching missing, self-invocation bypass, key generation, TTL configuration, cache eviction, and Caffeine vs Redis setup.
Fix: Spring Data JPA Query Not Working — @Query, Derived Methods, and N+1 Problems
How to fix Spring Data JPA query issues — JPQL vs native SQL, derived method naming, @Modifying for updates, pagination, projections, and LazyInitializationException.
Fix: Spring Boot @Transactional Not Rolling Back — Transaction Committed Despite Exception
How to fix Spring @Transactional not rolling back — checked vs unchecked exceptions, self-invocation proxy bypass, rollbackFor, transaction propagation, and nested transactions.
Fix: Hibernate LazyInitializationException — Could Not Initialize Proxy
How to fix Hibernate LazyInitializationException — loading lazy associations outside an active session, fetch join, @Transactional scope, DTO projection, and Open Session in View.
Fix: Spring Boot Failed to Configure a DataSource
How to fix 'Failed to configure a DataSource: url attribute is not specified' in Spring Boot — adding database properties, excluding DataSource auto-configuration, H2 vs production DB setup, and multi-datasource configuration.
Fix: Spring Boot "The dependencies of some of the beans in the application context form a cycle"
How to fix Spring Boot circular dependency errors — BeanCurrentlyInCreationException, refactoring to break cycles, @Lazy injection, setter injection, and @PostConstruct patterns.
Fix: Spring Security Returning 403 Forbidden Unexpectedly
How to fix Spring Security 403 Forbidden errors — CSRF token missing, incorrect security configuration, method security blocking requests, and how to debug the Spring Security filter chain.
Fix: Spring Boot Failed to Configure DataSource (DataSource Auto-Configuration Error)
How to fix Spring Boot 'Failed to configure a DataSource' errors — missing URL property, driver class not found, connection refused, and how to correctly configure datasource properties for MySQL, PostgreSQL, and H2.
Fix: Spring BeanCreationException: Error creating bean with name
How to fix Spring BeanCreationException error creating bean caused by missing dependencies, circular references, wrong annotations, configuration errors, and constructor issues.
Fix: Spring Boot Web server failed to start. Port 8080 was already in use
How to fix the Spring Boot error 'Web server failed to start. Port 8080 was already in use' by killing blocking processes, changing ports, fixing IDE issues, and resolving Docker conflicts.
Fix: Spring Boot Whitelabel Error Page - This application has no explicit mapping
How to fix the Spring Boot Whitelabel Error Page caused by missing controller mappings, wrong component scan, wrong package structure, and missing Thymeleaf templates.
Kotlin (4)
Fix: Kotlin Flow Not Working — Not Collecting, StateFlow Not Updating, or Flow Cancelled Unexpectedly
How to fix Kotlin Flow issues — cold vs hot flows, collectLatest vs collect, StateFlow and SharedFlow setup, lifecycle-aware collection in Android, and common Flow cancellation problems.
Fix: Kotlin Sealed Class Not Working — when Expression Not Exhaustive or Subclass Not Found
How to fix Kotlin sealed class issues — when exhaustiveness, sealed interface vs class, subclass visibility, Result pattern, and sealed classes across modules.
Fix: Kotlin Coroutine Not Executing — launch{} or async{} Blocks Not Running
How to fix Kotlin coroutines not executing — CoroutineScope setup, dispatcher selection, structured concurrency, cancellation handling, blocking vs suspending calls, and exception propagation.
Fix: Kotlin Coroutine Scope Cancelled — JobCancellationException or Coroutine Not Running
How to fix Kotlin coroutine cancellation issues — scope lifecycle, SupervisorJob, CancellationException handling, structured concurrency, viewModelScope, and cooperative cancellation.
Build Tools (4)
Fix: Gradle Could Not Resolve Dependencies Error
How to fix Gradle's 'Could not resolve all dependencies' error caused by missing repositories, offline mode, proxy issues, version conflicts, and corrupted cache.
Fix: Maven Could Not Resolve Dependencies - Failed to Read Artifact Descriptor
How to fix Maven's 'Could not resolve dependencies' and 'Failed to read artifact descriptor' errors caused by corrupted cache, proxy settings, missing repositories, and version conflicts.
Fix: Gradle Build Failed – Could Not Resolve Dependencies or Compilation Error
How to fix Gradle build failures including dependency resolution errors, compilation failures, incompatible Java versions, and daemon issues.
Fix: java.lang.ClassNotFoundException (Class Not Found at Runtime)
How to fix Java ClassNotFoundException at runtime by resolving missing dependencies, classpath issues, Maven/Gradle configuration, JDBC drivers, classloader problems, and Java module system errors.