File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes When does java.lang.IllegalStateException occur? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "When does java.lang.IllegalStateException occur?" Watch "When does java.lang.IllegalStateException occur?" New topic

When does java.lang.IllegalStateException occur?

viki Bhardwaj
Ranch Hand

Joined: Nov 07, 2011
Posts: 74

I am working on the project on jsp,servlet and database using mysql when i deploy the project then i found java.lang.IllegalStateException this exception. but i am unable to trace that why it occuring and where i m missing something..Exceptions are as bellow:

org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
at org.apache.catalina.loader.WebappClassLoader.loadClass(
at org.apache.catalina.loader.WebappClassLoader.loadClass(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at com.mysql.jdbc.Util.getInstance(
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.ConnectionImpl.getMutex(
at com.mysql.jdbc.ConnectionImpl.rollback(
at com.ibatis.common.jdbc.SimpleDataSource.forceCloseAll(
at com.ibatis.common.jdbc.SimpleDataSource.finalize(
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(
at java.lang.ref.Finalizer.access$100(
at java.lang.ref.Finalizer$

Please suggest me with possible reasons:
Pyla Rao
Ranch Hand

Joined: Jul 10, 2012
Posts: 51
The Java Illegal state exception states that you are attempting writing out put stream after response has been committed.
For solving this problem including return statement immediately after send redirect or forward statement.
Vishal Shaw
Ranch Hand

Joined: Aug 09, 2012
Posts: 179
You can read it here

Programming is about thinking, NOT coding
viki Bhardwaj
Ranch Hand

Joined: Nov 07, 2011
Posts: 74

thanks to all of you
for your valuable reply.
I agree. Here's the link:
subject: When does java.lang.IllegalStateException occur?
It's not a secret anymore!