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

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

问题描述

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

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"/>

我的课堂:

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)

在 doStuff 方法中:

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 ?

推荐答案

重启tomcat和apache后问题解决,tomcat缓存旧版本的app.

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

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

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