Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-10675

Hot undeployment of exploded WAR throws an exception when trying to load a class not previously loaded

    Details

    • Steps to Reproduce:
      Hide

      Hot undeploy an exploded WAR that contains a context listener which, when shutting down, loads a class never before loaded.

      Show
      Hot undeploy an exploded WAR that contains a context listener which, when shutting down, loads a class never before loaded.
    • Affects:
      Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      One workaround is to explicitly load the class during initialization so it is cached by the classloader and available later.

      Another is to use a jboss-structure.xml to force the WAR's contents to be copied to a temp location on deploy even though the WAR already is exploded:

      <structure>
      <context modification="temp">
      <path name=""/>
      <metaDataPath>
      <path name="WEB-INF"/>
      </metaDataPath>
      <classpath>
      <path name="WEB-INF/classes"/>
      <path name="WEB-INF/lib" suffixes=".jar"/>
      </classpath>
      </context>
      </structure>
      
      Show
      One workaround is to explicitly load the class during initialization so it is cached by the classloader and available later. Another is to use a jboss-structure.xml to force the WAR's contents to be copied to a temp location on deploy even though the WAR already is exploded: <structure> <context modification= "temp" > <path name=""/> <metaDataPath> <path name= "WEB-INF" /> </metaDataPath> <classpath> <path name= "WEB-INF/classes" /> <path name= "WEB-INF/lib" suffixes= ".jar" /> </classpath> </context> </structure>
    • Estimated Difficulty:
      Low
    • Release Notes Text:
      Hide
      <para>During hot-undeployment of WARs, if the application had a context listener which tried to load a never-before loaded class when the context was shutting down, an exception was thrown. This occurred for exploded WARs, but also for un-exploded WARs where the required class was located in the WAR archive itself, and not in an included library. This happened because the original file containing the class no longer existed. To fix this issue, a system property, <code>-Djboss.war.forceCopy=true</code>, can now be used to force WARs to be copied when deployed. This ensures that even when a deployment is removed from the deploy directory, its resources are available for classloading to correctly function as the WAR is shutting down.</para>
      Show
      <para>During hot-undeployment of WARs, if the application had a context listener which tried to load a never-before loaded class when the context was shutting down, an exception was thrown. This occurred for exploded WARs, but also for un-exploded WARs where the required class was located in the WAR archive itself, and not in an included library. This happened because the original file containing the class no longer existed. To fix this issue, a system property, <code>-Djboss.war.forceCopy=true</code>, can now be used to force WARs to be copied when deployed. This ensures that even when a deployment is removed from the deploy directory, its resources are available for classloading to correctly function as the WAR is shutting down.</para>
    • Release Notes Docs Status:
      Documented as Resolved Issue
    • Docs QE Status:
      NEW

      Description

      If an exploded WAR is hot undeployed and has a context listener which tries to load a never before loaded class when the context is shutting down, an exception is thrown because the original file containing the class no longer exists. An example is:

      2012-09-05 13:16:12,458 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/domaindocservice03]] (HDScanner) Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
      java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener
              at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
              at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3949)
              at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4578)
              at org.apache.catalina.core.ContainerBase.destroy(ContainerBase.java:1175)
              at org.apache.catalina.core.StandardContext.destroy(StandardContext.java:4668)
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  csams Chris Sams
                  Reporter:
                  csams Chris Sams
                  Writer:
                  Lucas Costi
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: