Java
Spring Boot
ArrayStoreException
Exception Handling
Troubleshooting

Spring boot errorjava.lang.ArrayStoreException sun.reflect.annotation.TypeNotPresentExceptionProxy

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy in a Spring Boot application usually points to a missing class referenced by an annotation. The exception looks strange because Java is trying to materialize annotation metadata through reflection, encounters a type that is not on the classpath, and then fails while storing a proxy object where a real class value was expected.

Understand what the error is really saying

The visible exception is often not the root problem. The real issue is usually one of these:

  • an annotation references a class that no longer exists
  • a dependency containing an annotation type or class value is missing
  • compiled code and runtime classpath are out of sync

For example, this can happen with annotations that take Class<?> values, arrays of classes, or nested configuration types.

Look for the first missing-type clue in the stack trace

The stack trace often contains a more informative TypeNotPresentException or ClassNotFoundException deeper down. That missing class name is the key diagnostic detail.

text
Caused by: java.lang.TypeNotPresentException: Type com.example.LegacyHandler not present

Once you know which type is missing, work backward to the annotation or dependency that references it.

Typical causes in Spring Boot projects

A common pattern is refactoring code and removing or renaming a class that still appears in an annotation.

java
1@Target(ElementType.TYPE)
2@Retention(RetentionPolicy.RUNTIME)
3public @interface UsesHandler {
4    Class<?> value();
5}
6
7@UsesHandler(LegacyHandler.class)
8public class DemoService {
9}

If LegacyHandler is deleted or removed from the runtime classpath, reflective annotation parsing can trigger the proxy-based failure.

Another common cause is version mismatch between modules. One module was compiled against a dependency that contained the class, while the runtime application starts with a different dependency set.

Clean and rebuild before deeper debugging

Because annotation metadata is compiled into class files, stale build output can keep old references alive.

bash
./mvnw clean package
# or
./gradlew clean build

If the error disappears after a clean rebuild, the runtime was likely using outdated compiled artifacts.

Check dependency alignment explicitly

Spring Boot projects with many starters or multi-module builds can drift into incompatible dependency sets. Inspect the resolved dependency graph and verify that the jar containing the missing class is present.

bash
./mvnw dependency:tree
# or
./gradlew dependencies

This is especially important after excluding transitive dependencies, changing starter versions, or moving code between modules.

Minimize the suspicious annotation surface

If the stack trace points near a specific configuration class, temporarily remove or simplify annotations there until the startup failure disappears. This is often faster than searching the whole codebase abstractly. Focus on annotations that accept class literals, arrays, imports, custom handlers, or framework extension points.

Common Pitfalls

  • Treating ArrayStoreException as the real bug instead of looking for the missing type behind it.
  • Ignoring the deepest Caused by entry that names the absent class.
  • Forgetting to clean and rebuild after annotation-bearing classes were renamed or deleted.
  • Overlooking version mismatch across modules or starters in a multi-module Spring Boot build.
  • Searching only application code when the missing annotation-referenced type actually came from a removed dependency.

Summary

  • This error usually means an annotation references a class that is missing at runtime.
  • The useful clue is deeper in the stack trace, often as TypeNotPresentException or ClassNotFoundException.
  • Clean the build and verify dependency alignment before assuming Spring itself is broken.
  • Inspect annotations that contain class literals or arrays of classes.
  • Fix the missing type or classpath mismatch, and the proxy-related exception usually disappears.

Related reading
Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.