File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes java.lang.IllegalStateException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "java.lang.IllegalStateException" Watch "java.lang.IllegalStateException" New topic
Author

java.lang.IllegalStateException

vinoth Robert
Ranch Hand

Joined: Feb 02, 2011
Posts: 31

hi greeting from vinoth....

I am developing a web application which needs to run a task every day at 5 pm. For example updating a table every day.

i am using the following code scheduler is a Class

public void start()
{
scheduler.schedule(new SchedulerTask()
{
public void run()
{
soundAlarm();
}
private void soundAlarm()
{
try
{

//this is the function which contains code to update table

general.CommonDataBase com_schedule = new general.CommonDataBase();
com_schedule.qtyCleanup();

System.out.println("Qty Cleaned up");
}catch(Exception e){}

}
}, new DailyIterator(hourOfDay, minute, second));
}


then i have created a servlet class and configured in web.xml

servlet code is here

public class ScheduleRunner implements Servlet
{
public void init(ServletConfig config) throws ServletException
{
MSchedule mschedule = new MSchedule(10, 06, 0);
mschedule.start();
}

public void service(ServletRequest request, ServletResponse response)throws ServletException, IOException
{ }

public void destroy()
{ }

public String getServletInfo() {
return null;
}
public ServletConfig getServletConfig() {
return null;
}
}


it works. But i get the following error message in tomcat

Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load java.lang.StringBuilder. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.CommonDataBase.<init>(CommonDataBase.java:64)
at Schedule.MSchedule$1.run(MSchedule.java:63)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load java.sql.Date. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.CommonDataBase.<init>(CommonDataBase.java:67)
at Schedule.MSchedule$1.run(MSchedule.java:63)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load com.mysql.jdbc.Driver. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at general.DBConnection.getConnect(DBConnection.java:18)
at general.CommonDataBase.qtyCleanup(CommonDataBase.java:1130)
at Schedule.MSchedule$1.run(MSchedule.java:64)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load java.lang.System. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.DBConnection.getConnect(DBConnection.java:25)
at general.CommonDataBase.qtyCleanup(CommonDataBase.java:1130)
at Schedule.MSchedule$1.run(MSchedule.java:64)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
Unable to connect to database.java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
INFO: Illegal access: this web application instance has been stopped already. Could not load java.io.PrintStream. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.DBConnection.getConnect(DBConnection.java:25)
at general.CommonDataBase.qtyCleanup(CommonDataBase.java:1130)
at Schedule.MSchedule$1.run(MSchedule.java:64)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
stock clean upjava.lang.NullPointerException
INFO: Illegal access: this web application instance has been stopped already. Could not load java.sql.Connection. 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.
Qty Cleaned up
java.lang.IllegalStateException
It's 12 Apr 2011 09:50:00.062 Now!
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.CommonDataBase.qtyCleanup(CommonDataBase.java:1133)
at Schedule.MSchedule$1.run(MSchedule.java:64)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Qty Cleaned up


why this error comes & any solution please....


vinoth.R
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19790
    
  20

I can clearly remember asking you to UseCodeTags before.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
vinoth Robert
Ranch Hand

Joined: Feb 02, 2011
Posts: 31

ok

hi greeting from vinoth....

I am developing a web application which needs to run a task every day at 5 pm. For example updating a table every day.

i am using the following code scheduler is a Class




then i have created a servlet class and configured in web.xml

servlet code is here



it works. But i get the following error message in tomcat

Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load java.lang.StringBuilder. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.CommonDataBase.<init>(CommonDataBase.java:64)
at Schedule.MSchedule$1.run(MSchedule.java:63)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load java.sql.Date. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.CommonDataBase.<init>(CommonDataBase.java:67)
at Schedule.MSchedule$1.run(MSchedule.java:63)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load com.mysql.jdbc.Driver. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at general.DBConnection.getConnect(DBConnection.java:18)
at general.CommonDataBase.qtyCleanup(CommonDataBase.java:1130)
at Schedule.MSchedule$1.run(MSchedule.java:64)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load java.lang.System. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.DBConnection.getConnect(DBConnection.java:25)
at general.CommonDataBase.qtyCleanup(CommonDataBase.java:1130)
at Schedule.MSchedule$1.run(MSchedule.java:64)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
Unable to connect to database.java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
INFO: Illegal access: this web application instance has been stopped already. Could not load java.io.PrintStream. 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.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.DBConnection.getConnect(DBConnection.java:25)
at general.CommonDataBase.qtyCleanup(CommonDataBase.java:1130)
at Schedule.MSchedule$1.run(MSchedule.java:64)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Apr 12, 2011 9:50:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
stock clean upjava.lang.NullPointerException
INFO: Illegal access: this web application instance has been stopped already. Could not load java.sql.Connection. 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.
Qty Cleaned up
java.lang.IllegalStateException
It's 12 Apr 2011 09:50:00.062 Now!
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at general.CommonDataBase.qtyCleanup(CommonDataBase.java:1133)
at Schedule.MSchedule$1.run(MSchedule.java:64)
at Schedule.Scheduler$SchedulerTimerTask.run(Scheduler.java:55)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Qty Cleaned up

why this error comes & any solution please....
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19790
    
  20

I think your timer / scheduler keeps running even though the web application has been stopped. Try stopping mschedule in the servlet's destroy() method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.IllegalStateException