Java Errors
Common Java errors and how to fix them.
95 errorsCannot invoke "com.devinhyderabad.shop.Customer.getCity()" because the return value of "com.devinhyderabad.shop.OrderService.findCustomer(java.lang.Long)" is null
Since JDK 15 the JVM names the exact null value right in the message — learn to read the JEP 358 hint and fix the dereference instead of guessing.
ClassNotFoundException: com.devinhyderabad.pay.PaymentGateway
The JVM searched every classpath location for a class referenced by its dotted name and found nothing — usually a missing JDBC driver, a reflective load, or a fat jar that never packed the dependency.
NoClassDefFoundError: com/devinhyderabad/pay/PaymentGateway
The class existed at compile time but vanished from the runtime classpath — this LinkageError strikes on first real use, and its Caused by chain shows the slash-form name the loader actually wanted.
Has been compiled by a more recent version of the Java Runtime (class file version 65.0)
Your jar was compiled by a newer JDK than the JVM running it — class file version 65.0 needs Java 21, and an older runtime refuses to link it.
OutOfMemoryError: Java heap space
The JVM asked the garbage collector for room and none existed — heap exhausted, and every OOM variant (Metaspace, GC overhead, native threads) has a different culprit and fix.
ConcurrentModificationException
A fail-fast iterator caught a structural modification mid-walk — usually plain single-threaded code calling list.remove() inside a for-each loop.
All Java errors
- (com.devinhyderabad.plugin.Api is in unnamed module of loader java.net.URLClassLoader @1dbd16a6; com.devinhyderabad.plugin.Api is in unnamed module of loader 'app') — ClassCastException: class cannot be cast to class of the same name
- ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 3
- ArrayStoreException: java.lang.Integer
- Cannot invoke "com.devinhyderabad.shop.Customer.getCity()" because the return value of "com.devinhyderabad.shop.OrderService.findCustomer(java.lang.Long)" is null
- ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')
- ClassNotFoundException: com.devinhyderabad.pay.PaymentGateway
- ConcurrentModificationException
- Duplicate class com.google.common.collect.ListenableFuture found in modules guava-26.0-android.jar (com.google.guava:guava:26.0-android) and listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar (com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava)
- FileNotFoundException: data.csv (No such file or directory)
- Found one Java-level deadlock:
- Has been compiled by a more recent version of the Java Runtime (class file version 65.0)
- IllegalArgumentException: No enum constant com.devinhyderabad.pay.Status.COMPLTED
- InterruptedException: sleep interrupted
- java.lang.AbstractMethodError: Receiver class com.devinhyderabad.pay.LegacyNotifier does not define or inherit an implementation of the resolved method 'abstract void send(java.lang.String)' of interface com.devinhyderabad.pay.Notifier
- java.lang.annotation.AnnotationFormatError: Invalid default: com.devinhyderabad.annotations.Level
- java.lang.annotation.IncompleteAnnotationException: com.devinhyderabad.Todo missing element value
- java.lang.ArithmeticException: / by zero
- java.lang.ArithmeticException: BigInteger divide by zero
- java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
- java.lang.ArithmeticException: Rounding necessary
- java.lang.BootstrapMethodError: call site initialization exception
- java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Ljava.lang.String; ([Ljava.lang.Object; and [Ljava.lang.String; are in module java.base of loader 'bootstrap')
- java.lang.ClassFormatError: Incompatible magic value 218762506 in class file com/devinhyderabad/app/Main
- java.lang.ExceptionInInitializerError
- java.lang.IllegalAccessError: class com.devinhyderabad.tools.Profiler cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not export sun.nio.ch to unnamed module @1a6c5a8e
- java.lang.IllegalAccessError: tried to access method void com.devinhyderabad.core.BaseService.start()V from class com.devinhyderabad.web.PluginServlet
- java.lang.IllegalAccessException: class com.devinhyderabad.ReflectiveClient can not access a member of class com.devinhyderabad.SecretService with modifiers "private"
- java.lang.IllegalArgumentException: Comparison method violates its general contract!
- java.lang.IllegalArgumentException: duplicate element: red
- java.lang.IllegalArgumentException: fromIndex(2) > toIndex(1)
- java.lang.IllegalArgumentException: Illegal Capacity: -1
- java.lang.IllegalArgumentException: Illegal initial capacity: -1
- java.lang.IllegalArgumentException: wrong number of arguments: 1 expected: 0
- java.lang.IllegalMonitorStateException at AbstractQueuedSynchronizer$ConditionObject.enableWait
- java.lang.IllegalMonitorStateException at ReentrantLock$Sync.tryRelease
- java.lang.IllegalMonitorStateException: current thread is not owner
- java.lang.IllegalStateException at ArrayList$Itr.remove
- java.lang.IllegalStateException: Duplicate key k (attempted merging values 1 and 2)
- java.lang.IllegalStateException: Recursive update
- java.lang.IllegalStateException: stream has already been operated upon or closed
- java.lang.IllegalStateException: Timer already cancelled.
- java.lang.IllegalThreadStateException at Thread.start
- java.lang.IncompatibleClassChangeError: class com.devinhyderabad.search.Worker has interface com.devinhyderabad.search.Codec as super class
- java.lang.IndexOutOfBoundsException: Index: 5, Size: 3
- java.lang.InstantiationException at Constructor.newInstance
- java.lang.InterruptedException at LinkedBlockingQueue.take
- java.lang.InterruptedException at Object.wait
- java.lang.LayerInstantiationException: Package com.devinhyderabad.model in both module devtoolpick.legacy and module devtoolpick.core
- java.lang.LinkageError: loader constraint violation: when resolving method "com.devinhyderabad.api.DaoFactory.create()Lcom/devinhyderabad/api/Dao;" the class loader "app" of the current class and the class loader of the method's defining class have different Class objects for the type com/devinhyderabad/api/Dao used in the signature
- java.lang.module.ResolutionException: Modules slf4j.log4j12 and log4j export package org.apache.log4j to module kubernetes.model.common
- java.lang.NegativeArraySizeException: -3
- java.lang.NoSuchFieldError: Class com.devinhyderabad.search.IndexConfig does not have member field 'int DEFAULT_SHARD_COUNT'
- java.lang.NoSuchFieldException: userName
- java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;J)V
- java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;
- java.lang.NoSuchMethodException: com.devinhyderabad.UserService.login(java.lang.String)
- java.lang.NullPointerException at ImmutableCollections$Map1.<init>
- java.lang.reflect.GenericSignatureFormatError: Signature Parse error: expected field type
- java.lang.reflect.InaccessibleObjectException: Unable to make field private final byte[] java.lang.String.value accessible: module java.base does not "opens java.lang" to unnamed module @2b2fa4f7
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.MalformedParametersException: Invalid constant pool index
- java.lang.reflect.UndeclaredThrowableException
- java.lang.SecurityException: class "org.bouncycastle.jce.provider.BouncyCastleProvider"'s signer information does not match signer information of other classes in the same package
- java.lang.StackOverflowError
- java.lang.ThreadDeath
- java.lang.TypeNotPresentException: Type javax.xml.bind.annotation.XmlRootElement not present
- java.lang.UnsatisfiedLinkError: no nativesqlite in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
- java.lang.VerifyError: Bad type on operand stack
- java.nio.channels.ClosedByInterruptException
- java.security.AccessControlException: access denied ("java.lang.reflect.ReflectPermission" "suppressAccessChecks")
- java.text.ParseException: Unparseable date: "31/12/2026"
- java.time.DateTimeException: Invalid date 'FEBRUARY 30'
- java.time.format.DateTimeParseException: Text '2026-13-01' could not be parsed: Invalid value for MonthOfYear (valid values 1 - 12): 13
- java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay
- java.util.concurrent.BrokenBarrierException at CyclicBarrier.dowait
- java.util.concurrent.CancellationException at FutureTask.report
- java.util.concurrent.CompletionException: java.lang.IllegalStateException: stock reservation failed
- java.util.concurrent.CompletionException: java.util.concurrent.TimeoutException
- java.util.concurrent.ExecutionException: java.lang.RuntimeException: Payment gateway unreachable after 3 attempts
- java.util.concurrent.ExecutionException: java.sql.SQLException: no such row
- java.util.concurrent.RejectedExecutionException: Task com.devinhyderabad.jobs.ReportJob$$Lambda$57/0x0000000801046ac8@5674cd4d rejected from java.util.concurrent.ThreadPoolExecutor@23fc625e[Running, pool size = 1, active threads = 1, queued tasks = 1, completed tasks = 0]
- java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@30f39991[Not completed, task = com.devinhyderabad.jobs.ReportJob$$Lambda$42/0x0000000801046228@a09ee92] rejected from java.util.concurrent.ThreadPoolExecutor@5caf905d[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 42]
- java.util.concurrent.TimeoutException at CompletableFuture.timedGet
- java.util.EmptyStackException
- java.util.InputMismatchException
- java.util.NoSuchElementException at ArrayList$Itr.next
- java.util.NoSuchElementException: No line found
- java.util.NoSuchElementException: No value present
- java.util.ServiceConfigurationError: com.devinhyderabad.export.Exporter: provider com.devinhyderabad.export.PdfExporter not found
- java.util.zip.ZipException: zip END header not found
- javax.lang.model.type.MirroredTypesException: Attempt to access Class objects for TypeMirrors
- NoClassDefFoundError: com/devinhyderabad/pay/PaymentGateway
- NumberFormatException: For input string: "abc"
- OutOfMemoryError: Java heap space
- UnsupportedOperationException