非法访问:此Web应用程序实例已被停止

我有一个具有在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();

}

}

当应用启动时,这些线程运行良好,并且一切正常,一段时间后,我收到以下异常。

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方法中:

public void doStuff(){

Session sessioned = Session.getDefaultInstance(System.getProperties(),

null);

Store store = sessioned.getStore("imap");

store.connect(hostName, userName, password);

.

.

.

}

我不知道为什么,有什么想法吗?

回答:

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

以上是 非法访问:此Web应用程序实例已被停止 的全部内容, 来源链接: utcz.com/qa/435322.html

回到顶部