Illegal access: this web application instance has been stopped already

前端 未结 5 1845
心在旅途
心在旅途 2020-12-13 09:56

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



        
相关标签:
5条回答
  • 2020-12-13 10:12

    I suspect that this occurs after an attempt to undeploy your app. Do you ever kill off that thread that you've initialised during the init() process ? I would do this in the corresponding destroy() method.

    0 讨论(0)
  • 2020-12-13 10:14

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

    0 讨论(0)
  • 2020-12-13 10:25

    Restarting Your Server Can Resolve this problem.

    I was getting the same error while Using Dynamic Jasper Reporting , When i deploy my Application for first use to Create Reports, the Report creation works fine, But Once I Do Hot Deployment of some code changes To the Server, I was getting This Error.

    0 讨论(0)
  • 2020-12-13 10:26

    In short: this happens likely when you are hot-deploying webapps. For instance, your ide+development server hot-deploys a war again. Threads, that have been created previously are still running. But meanwhile their classloader/context is invalid and faces the IllegalAccessException / IllegalStateException becouse its orgininating webapp (the former runtime-environment) has been redeployed.

    So, as states here, a restart does not permanently resolve this issue. Instead, it is better to find/implement a managed Thread Pool, s.th. like this to handle the termination of threads appropriately. In JavaEE you will use these ManagedThreadExeuctorServices. A similar opinion and reference here.

    Examples for this are the EvictorThread of Apache Commons Pool, that "cleans" pooled instances according to the pool's configuration (max idle etc.).

    0 讨论(0)
  • 2020-12-13 10:30

    If it's a local development tomcat launched from IDE, then restarting this IDE and rebuild project also helps.

    0 讨论(0)
提交回复
热议问题