How can I get a webapp to exit gracefully if I delete it's deployment while it has a thread running?

岁酱吖の 提交于 2019-12-11 13:45:13

问题


I have a Spring MVC webapp, that as part of its operation runs off and performances several SQL queries, that can take up to 15 minutes to run.

If you delete the deployment while a query is running, the weblogic log will print the following stacktrace:

POST /MyWebapp/submitQuery HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: en-nz
Referer: http://server:1111/mywebapp/
Accept: */*
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Content-Length: 268
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=KgJ5VnFLpWTp1ZNjwt3p1D4FHxmSQnPpTTwX18TDyMxnpgGBXWTD!1657710130; ADMINCONSOLESESSION=tSWjVnXJb6MPn0Bj9h4FPWvyzHC5pbCf2H20ZgfGHLTKpykMN82m!802748838

]] Root cause of ServletException.
java.lang.NoClassDefFoundError: org/apache/log4j/DefaultThrowableRenderer
    at org.apache.log4j.spi.ThrowableInformation.getThrowableStrRep(ThrowableInformation.java:87)
    at org.apache.log4j.spi.LoggingEvent.getThrowableStrRep(LoggingEvent.java:413)
    at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:313)
    at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
    at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
    at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
    at org.apache.log4j.Category.callAppenders(Category.java:206)
    at org.apache.log4j.Category.forcedLog(Category.java:391)
    at org.apache.log4j.Category.log(Category.java:856)
    at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:166)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:989)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)

If you wait for queries to finish before deleting the deployment, then the errors will not be posted.

I've been told that it's not acceptable for this stacktrace to be thrown.

Two questions:

  1. What actually happens if you delete a deployment while a thread is running?

  2. How can I get Weblogic to handle it gracefully?

来源:https://stackoverflow.com/questions/31465118/how-can-i-get-a-webapp-to-exit-gracefully-if-i-delete-its-deployment-while-it-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!