[MAGNOLIA-228] Running more than one instance in a single tomcat does not work because of static variables and functions Created: 30/Nov/04  Updated: 20/Dec/04  Resolved: 20/Dec/04

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 2.0 Final
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Ralf Hirning Assignee: Sameer Charles
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Installation of more than one instance as services in one tomcat server


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Running more than one instance in a single tomcat does not work because of static variables. All services run in the same JVM and therefore they share the same static variables.

At least the following variables and functions produce problems or deliver unpredictable results:

  • info.magnolia.custom.search.lucene.Index.indexDirectory
  • info.magnolia.logging.Configurator.configure()
  • info.magnolia.logging.Configurator.configure(String path)
  • info.magnolia.module.templating.Store.store
  • info.magnolia.module.adminInterface.Store.store
  • info.magnolia.cms.util.AccessLock.set()
  • info.magnolia.cms.util.AccessLock.release()
  • info.magnolia.cms.util.AccessLock.isSet()
  • info.magnolia.cms.util.AccessLock.getLockFile()
  • info.magnolia.cms.util.Path.getCacheDirectoryPath()
  • info.magnolia.cms.util.Path.getTempDirectoryPath()
  • info.magnolia.cms.util.Path.getLogPropertiesFilePath()
  • info.magnolia.cms.util.Path.getHistoryFilePath()
  • info.magnolia.cms.util.Path.getJCRItemTypesFile()
  • info.magnolia.cms.util.Path.getRepositoriesConfigFilePath()
  • info.magnolia.cms.util.Path.getRepositoryFactoryConfigFilePath()
  • info.magnolia.cms.security.Lock.isSystemLocked
  • info.magnolia.cms.security.Lock.lockSetDate
  • info.magnolia.cms.security.Lock.lockedHierarchyList
  • info.magnolia.cms.exchange.ice.ChannelFactory.channels
  • info.magnolia.cms.beans.config.ContentRepository.repositories
  • info.magnolia.cms.beans.config.ContentRepository.hierarchyManagers
  • info.magnolia.cms.beans.config.ContentRepository.hierarchyManagers
  • info.magnolia.cms.beans.config.ContentRepository.repositoryMappings
  • info.magnolia.cms.beans.config.ContentRepository.repositoryFactory
  • info.magnolia.cms.beans.config.MIMEMapping.MIMEList
  • info.magnolia.cms.beans.config.MIMEMapping.cachedContent
  • info.magnolia.cms.beans.config.Subscriber.ipList
  • info.magnolia.cms.beans.config.Subscriber.cachedContent
  • info.magnolia.cms.beans.config.Template.templates
  • info.magnolia.cms.beans.config.Template.visibleTemplates
  • info.magnolia.cms.beans.config.Template.cachedContent
  • info.magnolia.cms.beans.config.Cache.cachedCacheableURIMapping
  • info.magnolia.cms.beans.config.Cache.compressionList
  • info.magnolia.cms.beans.config.Cache.isCacheable
  • info.magnolia.cms.beans.config.Cache.domain
  • info.magnolia.cms.beans.config.Listener.ipList
  • info.magnolia.cms.beans.config.Listener.cachedContent
  • info.magnolia.cms.beans.config.Paragraph.paragraphs
  • info.magnolia.cms.beans.config.Paragraph.cachedContent
  • info.magnolia.cms.beans.config.VirtualMap.cachedURImapping
  • info.magnolia.cms.beans.config.VirtualMap.virtualMap
  • info.magnolia.cms.beans.config.Server.cachedContent
  • info.magnolia.cms.beans.config.Server.cachedURImapping
  • info.magnolia.cms.beans.config.Server.cachedCacheableURIMapping
  • info.magnolia.cms.beans.config.ItemType.map
  • info.magnolia.cms.beans.runtime.SecureURI.cachedContent
  • info.magnolia.cms.beans.runtime.SecureURI.hierarchyManager
  • info.magnolia.cms.beans.runtime.SystemProperty.properties
  • info.magnolia.cms.beans.runtime.Cache.cachedURIList

You will have to change depending (static) methods as well. You should also check the logging.



 Comments   
Comment by Boris Kraft [ 01/Dec/04 ]

Static vars are evil, lets get rid of them before they get rid of us

Comment by Fabrizio Giustina [ 01/Dec/04 ]

If you deploy the magnolia/jcr jars in WEB-INF/lib each webapp will have its own classloader and static variables will not be shared.
Are you trying to put magnolia libs in tomcat/common/lib? Why should you need that?

Comment by Ortwin Glueck [ 01/Dec/04 ]

If I remember correctly the configuration works basically by putting everything into System properties. This is a shared resource across the JVM and poses a problem when running multiple instances on the same Appserver.

Comment by Ralf Hirning [ 01/Dec/04 ]

I tried again to setup both author and public instance on a single tomcat - and it works.
I really apologize for my accuses.

I put my configuration and configuration files to the wiki for reference

Ralf

Comment by Sameer Charles [ 17/Dec/04 ]

I do not agree with that, sure we should move to singleton classes - is that what you meant?

Generated at Mon Feb 12 03:15:21 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.