Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-3600

HstServices.getComponentManager() returns the wrong component manager when multiple WARs are deployed to a single tomcat instance

    XMLWordPrintable

Details

    • Question
    • Status: Closed
    • Normal
    • Resolution: Won't Fix
    • 2.24.07
    • None
    • hst-api
    • None

    Description

      As far as I can see the same bug is still in the code. Even in Hippo 10.

      The problem is as follows.
      We have two site's deployed in one Tomcat instance, site and site-iavans. Both have their own HstSiteServlet and I have set the parameter forcefull.reinit to make sure the component manager will be initialized for each webapp.

      When HstServices.getComponentManager() is called, the component manager will be returned of the last war that was initialized. Indepenedent of the context the code is beeing executed in. This will result in problems in the channel manager when trying to set the properties of a component. It will use the classloader of site-iavans when retrieving properties of a component that resides in site. But also when using the urlrewriter we run into problems. The site-iavans does not have the url-rewriter included, so when the RewritingManager is initialized with the call {{rewritingManager = HstServices.getComponentManager().getComponent("org.onehippo.forge.rewriting.repo.RewritingManager"); }} the class can't be found because the wrong cloassloader is used.

      I thought the forecfull.reinit solved the problem, but because HstServices is a static class, the component manager will be overwritten when the method setComponentManager() is called

      {{public static void setComponentManager(ComponentManager compManager)

      { componentManager = compManager; available = componentManager != null; }

      }}

      Maybe I overlooked something or I can change the configuration to solve this. But I think it's a bug in the code

      Attachments

        Activity

          People

            Unassigned Unassigned
            ronvanderkruit Ron van der Kruit
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: