What is IllegalStateException?

Usually, IllegalStateException is used to indicate that “a method has been invoked at an illegal or inappropriate time.” However, this doesn’t look like a particularly typical use of it.

The code you’ve linked to shows that it can be thrown within that code at line 259 – but only after dumping a SQLException to standard output.

We can’t tell what’s wrong just from that exception – and better code would have used the original SQLException as a “cause” exception (or just let the original exception propagate up the stack) – but you should be able to see more details on standard output. Look at that information, and you should be able to see what caused the exception, and fix it.

Leave a Comment