[opencms-dev] Fwd: Re: Is there a way to add a new site server without a restart?

Stephan Hartmann hartmann at metamesh.de
Fri Mar 19 10:57:31 CET 2010


Hi Olaitan,

My experience refers to OpenCms 6.2.3. but for 7.x it might be quite the
same.
If you patch the CmsSiteManagerImpl#initialize() to not freeze and not
change the configured maps into unmodifiable maps, you can add new sites at
runtime.
Also, the logic for writing out the changed configuration to
opencms-system.xml is already there, as it is used e.g. when you lock the
workplace or set a login message:

org.opencms.main.OpenCms#writeConfiguration(CmsSystemConfiguration.class);

HTH,
Stephan



2010/3/19 Olaitan Olamilehin <olaitan.olamilehin at moremr.com>

>  Hi Mario,
>
> Thanks for your reply. Yeah, later I found the description that the method
> can only be called at startup during system configuration.
>
> Initially, I was just curious to see if it was possible to do the same
> thing that is done when a new module is added, updated or deleted from the
> GUI because in these cases, the opencms-module.xml file is modified
> accordingly and the CmsModuleManager reloads the module configuration. A
> similar idea is also used in the "*Re-initialize workplace*" admin tool to
> reload the workplace configuration.
>
> Well, I still think it would be a good idea to have an interface in future
> to add new sites without having to restart the servlet container.  For
> example, in our case we might add multiple site configurations in a day and
> having a restart each time will disrupt other services that are running on
> the server.
>
> Thanks once again for you reply.
>
> Regards,
> Olaitan.
>
>
>
> -------- Original Message --------  Subject: Re: [opencms-dev] Is there a
> way to add a new site server without a restart?  Date: Fri, 19 Mar 2010
> 09:48:41 +0100  From: Mario Jäger <m.jaeger at alkacon.com><m.jaeger at alkacon.com>  To:
> olaitan.olamilehin at moremr.com, The OpenCms mailing list
> <opencms-dev at opencms.org> <opencms-dev at opencms.org>
>
> Hi Olaitan,
>
> It is always necessary to restart the servlet container after you changed the OpenCms
> configuration files. You can not use the method OpenCms.getSiteManager().addSite() to
> add a site after the OpenCms configuration is finished, because the description of
> this method says the following: "Adds a new CmsSite to the list of configured sites,
> this is only allowed during configuration. If this method is called after the
> configuration is finished, a RuntimeException is thrown."
>
> But I can not imagine, that you add many sites each day or week. That is why I can not
> imagine that you really need a workaround for this. Or how often do you want to add
> new sites?
>
> --
> Kind Regards,
> Mario.
>
> -------------------
> Mario Jäger
>
> Alkacon Software GmbH  - The OpenCms Experts                    http://www.alkacon.com - http://www.opencms.org
>
>
> Olaitan Olamilehin schrieb:
> > Hi all,
> >
> > Currently, a restart is needed each time a new site is added to the
> > opecms-system.xml config file. I tried to do this programmatically using
> > this method OpenCms.getSiteManager().addSite() but I got a
> > CmsConfigurationException stating "Site configuration has been frozen
> > and can no longer be changed".
> >
> > Is there any workaround for this? Any help will be highly appreciated.
> >
> >
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20100319/f741436e/attachment.htm>


More information about the opencms-dev mailing list