Uploaded image for project: 'InsightEdge Platform'
  1. GS-12979

Can't override pu.properties with external file while deploying war when specifying ContextLoaderListener in web.xml

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 12.1
    • Labels:
      None
    • Platform:
      Java
    • SalesForce Case ID:
      10665
    • Acceptance Test:
      reproduction test case
    • Story Points:
      25
    • Sprint:
      12.1-M3

      Description

      In Spring4 createContextLoader method of class spring class ContextLoaderListener was removed therefore our overriding in ProcessingUnitContextLoaderListener had no affect, and pu context was not injected into the web context. (customer changed to loadParentContext)

      Implications:
      1.Beans defined in pu xml could not be initiated without explicitly adding
      reference to 'pu.xml' in the 'contextConfigLocation
      2.could not override properties.

      Since we moved from Spring 3 to Spring 4 it is impossible to override properties using external properties file using the following command:
      gs> deploy -properties fil://external.properties mywar.war
      The structure of mywar.war contain:
      /META-INF/spring/pu.xml
      /META-INF/spring/pu.properties
      /WEB-INF/web.xml
      /WEB-INF/applicationContext.xml
      /WEB-INF/applicationContext-security.xml
      And the web.xml contain org.glassfish.jersey.servlet.ServletContainer
      Attached the web.xml file.

      The problem described here:
      http://stackoverflow.com/questions/30046792/spring-context-not-loaded
      "I found the problem it was with the SpringHttpContextLoaderListener. It was overridding a method createContextLoader and getContextLoader which was deprecated in Spring version 3 so was removed in Spring version 4. Due to this the Custom Context was not loaded as the parent context"

      See also:
      http://docs.gigaspaces.com/xap102/web-processing-unit-container.html , paragraph "Bootstrap Context Listener"

      The customer change the implementation of our org.openspaces.pu.container.jee.context.ProcessingUnitContextLoaderListener class and instead of:
      protected ContextLoader createContextLoader () {
              return new ProcessingUnitContextLoader();
          }

      He added:

        protected ApplicationContext loadParentContext(ServletContext servletContext)
                  throws BeansException {
              ProcessingUnitContextLoader puContextLoader = new ProcessingUnitContextLoader();
              return puContextLoader.loadParentContext(servletContext);
          }

      This change fixed the issue.

      You may find reproduction in case 10665.
      Check for the comment created By FastConnect support at 16:14 07/10/2016

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: