非法访问:此Web应用程序实例已经停止 [英] Illegal access: this web application instance has been stopped already

查看:9796
本文介绍了非法访问:此Web应用程序实例已经停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类,它有一个在xml中定义的init方法

 < bean id =appStarterclass = com.myapp.myClassinit-method =initdestroy-method =destroy/> 

myClass:

  public class myClass {

private Thread t;

public void init(){

t = new Thread(){

@Override
public void run(){
while(true)
try {
doStuff();
Thread.sleep(1000);
} catch(例外e){
e.printStackTrace();
}
}

};
t.start();
}

public void destroy(){
t.interrupt();
}

}

当应用启动时,这些线程运行正常,一切正常好
,过了一段时间我得到以下异常。

  INFO:非法访问:此Web应用程序实例已经停止。无法加载com.sun.mail.imap.IMAPStore。最后的堆栈跟踪是由于出于调试目的而抛出的错误以及尝试终止导致非法访问的线程而引起的,并且没有任何功能影响。 
$ java.lang.IllegalStateException在org.apache.catalina.loader.WebappClassLoader.loadClass B $ B(WebappClassLoader.java:1273)
在org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader .java:1233)
at javax.mail.Session.getService(Session.java:755)
at javax.mail.Session.getStore(Session.java:569)
at javax。 mail.Session.getStore(Session.java:531)javax.mail.Session.getStore $ $ $ $ $ $ $ $ $ $ $ $ $ doStuff方法中的b
$ b

  public void doStuff(){

Session sessioned = Session.getDefaultInstance(System.getProperties(),
null);
Store store = sessioned.getStore(imap);
store.connect(hostName,userName,password);




}

我不知道为什么,任何想法?

解决方案

重新启动tomcat和apache后问题解决了,tomcat正在缓存应用程序的旧版本。


I have a class which has an init-method defined in xml

<bean id="appStarter" class="com.myapp.myClass" init-method="init" destroy-method="destroy"/>

myClass:

public class myClass{

    private Thread t;

    public void init() {

             t = new Thread() {

                @Override
                public void run() {
                    while (true)
                        try {
                            doStuff();
                            Thread.sleep(1000);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                }

            };
            t.start();
        }

public void destroy() {
        t.interrupt();
    }

}

When the app starts, these threads run fine, and everything works just fine and after sometime i get the following exception.

INFO: Illegal access: this web application instance has been stopped already.  Could not load com.sun.mail.imap.IMAPStore.  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:1273)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at javax.mail.Session.getService(Session.java:755)
    at javax.mail.Session.getStore(Session.java:569)
    at javax.mail.Session.getStore(Session.java:531)
    at javax.mail.Session.getStore(Session.java:510)

in the doStuff method:

public void doStuff(){

Session sessioned = Session.getDefaultInstance(System.getProperties(),
                null);
        Store store = sessioned.getStore("imap");
        store.connect(hostName, userName, password);
.
.
.

}

I don't know why, any ideas ?

解决方案

Problem solved after restarting the tomcat and apache, the tomcat was caching older version of the app.

这篇关于非法访问:此Web应用程序实例已经停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆