Hi All,
We are implementing the tomcat load balancing for my application.
So, we need to share the same repository for all tomcats.
1) We have shared the repository folder for all tomcats (NSF mount)
2) added the cluster node in repository.xml
<Cluster id="node1">
<Journal class="org.apache.jackrabbit.core.journal.FileJournal">
<param name="revision" value="${rep.home}/revision.log" />
<param name="directory" value="${rep.home}/../shared" />
</Journal>
</Cluster>
3) added same repository.xml in all tomcats
4) First tomcat is started successfully
5) While starting the second tomcat, its throwing error.
Please advise.
Here is the error details:
19.09.2007 12:34:08 *INFO * [main] Init: [None] OCS RepositoryServlet
initializing.. (OcsLogger.java, line 80)
19.09.2007 12:34:08 *INFO * [main] Init: [None] repository-home =
/opt/webhost/ocs/shared/tomcat/mounted_data/jcr (OcsLogger.java, line
80)
19.09.2007 12:34:08 *INFO * [main] Init: [None] repository-config =
/opt/webhost/ocs/tomcat5.5.9/webapps/ocs/WEB-INF/content-repository/repo
sitory.xml (OcsLogger.java, line 80)
19.09.2007 12:34:08 *INFO * [main] Init: [None] repository-name =
ocs.repository (OcsLogger.java, line 80)
19.09.2007 12:34:08 *INFO * [main] Init: [None] jaas config =
/opt/webhost/ocs/tomcat5.5.9/webapps/ocs/WEB-INF/content-repository/jaas
.config (OcsLogger.java, line 80)
Sep 19, 2007 12:34:08 PM org.apache.jackrabbit.core.RepositoryImpl
<init>
INFO: Starting repository...
Sep 19, 2007 12:34:08 PM org.apache.jackrabbit.core.util.RepositoryLock
acquire
WARNING: Existing lock file
/opt/webhost/ocs/shared/tomcat/mounted_data/jcr/.lock detected.
Repository was not shut down properly.
19.09.2007 12:34:08 *ERROR* [main] Init: [None] Unable to initialize
repository: javax.jcr.RepositoryException: The repository home
/opt/webhost/ocs/shared/tomcat/mounted_data/jcr appears to be in use
since the file named .lock is locked by another
process.javax.jcr.RepositoryException: The repository home
/opt/webhost/ocs/shared/tomcat/mounted_data/jcr appears to be in use
since the file named .lock is locked by another process.
at
org.apache.jackrabbit.core.util.RepositoryLock.acquire(RepositoryLock.ja
va:129)
at
org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:229
)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:521
)
at
com.hp.ocs.j2ee.RepositoryServlet.startRepository(RepositoryServlet.java
:337)
at com.hp.ocs.j2ee.RepositoryServlet.init(RepositoryServlet.java:191)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(Unknown Source)
at org.apache.catalina.core.StandardWrapper.load(Unknown Source)
at org.apache.catalina.core.StandardContext.loadOnStartup(Unknown
Source)
at org.apache.catalina.core.StandardContext.start(Unknown Source)
at org.apache.catalina.core.ContainerBase.addChildInternal(Unknown
Source)
at org.apache.catalina.core.ContainerBase.addChild(Unknown Source)
at org.apache.catalina.core.StandardHost.addChild(Unknown Source)
at org.apache.catalina.startup.HostConfig.deployDescriptor(Unknown
Source)
at org.apache.catalina.startup.HostConfig.deployDescriptors(Unknown
Source)
at org.apache.catalina.startup.HostConfig.deployApps(Unknown Source)
at org.apache.catalina.startup.HostConfig.start(Unknown Source)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(Unknown
Source)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Unknown
Source)
at org.apache.catalina.core.ContainerBase.start(Unknown Source)
at org.apache.catalina.core.StandardHost.start(Unknown Source)
at org.apache.catalina.core.ContainerBase.start(Unknown Source)
at org.apache.catalina.core.StandardEngine.start(Unknown Source)
at org.apache.catalina.core.StandardService.start(Unknown Source)
at org.apache.catalina.core.StandardServer.start(Unknown Source)
at org.apache.catalina.startup.Catalina.start(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Unknown Source)
at org.apache.catalina.startup.Bootstrap.main(Unknown Source)
(OcsLogger.java, line 124)
Best Regards,
RK
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- <!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Repository//EN" "file://config.dtd"> -->
<!DOCTYPE Repository [
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
the Repository element configures a repository instance; individual
workspaces of the repository are configured through separate configuration
files called workspace.xml which are located in a subfolder of the
workspaces root directory (see Workspaces element).
it consists of
- a FileSystem element (the virtual file system
used by the repository to persist global state such as
registered namespaces, custom node types, etc..
- a Security element that specifies the name of the app-entry
in the JAAS config and the access manager
- a Workspaces element that specifies the location of the
workspaces root directory, the name of the default workspace,
the maximum idle time before a workspace is automatically
shutdown (optional) and the workspace configuration root directory
within the virtual repository file system (optional)
- a Workspace element that is used as a workspace configuration
template; it is used to create the initial workspace if there's
no workspace yet and for creating additional workspaces through
the api
- a Versioning element that is used for configuring
versioning-related settings
- a SearchIndex element that is used for configuring Indexing-related
settings on the /jcr:system tree.
- a Cluster element that is used for configuring an optional
clustering node that synchronizes changes made in a cluster
-->
<!ELEMENT Repository (FileSystem,Security,Workspaces,Workspace,Versioning,SearchIndex?,Cluster?)>
<!--
a virtual file system
-->
<!ELEMENT FileSystem (param*)>
<!ATTLIST FileSystem class CDATA #REQUIRED>
<!--
the Security element specifies the name (appName attribute)
of the JAAS configuration app-entry for this repository.
it also specifies the access manager to be used (AccessManager element).
-->
<!ELEMENT Security (AccessManager, LoginModule?)>
<!ATTLIST Security appName CDATA #REQUIRED>
<!--
the AccessManager element configures the access manager to be used by
this repository instance; the class attribute specifies the FQN of the
class implementing the AccessManager interface
-->
<!ELEMENT AccessManager (param*)>
<!ATTLIST AccessManager class CDATA #REQUIRED>
<!--
generic parameter (name/value pair)
-->
<!ELEMENT param EMPTY>
<!ATTLIST param name CDATA #REQUIRED
value CDATA #REQUIRED>
<!--
the LoginModule element optionally specifies a JAAS login module to
authenticate users. This feature allows the use of Jackrabbit in a
non-JAAS environment.
-->
<!ELEMENT LoginModule (param*)>
<!ATTLIST LoginModule class CDATA #REQUIRED>
<!--
the Workspaces element specifies the physical workspaces root directory
(rootPath attribute), the name of the default workspace (defaultWorkspace
attribute), the (optional) maximum amount of time in seconds before an idle
workspace is automatically shutdown (maxIdleTime attribute) and the
(optional) workspace configuration root directory within the virtual
repository file system (configRootPath attribute).
individual workspaces are configured through individual workspace.xml files
located in a subfolder each of either
a) the physical workspaces root directory
or, if configRootPath had been specified,
b) the configuration root directory within the virtual repository file
system.
-->
<!ELEMENT Workspaces EMPTY>
<!ATTLIST Workspaces rootPath CDATA #REQUIRED
defaultWorkspace CDATA #REQUIRED
configRootPath CDATA #IMPLIED
maxIdleTime CDATA #IMPLIED>
<!--
the Workspace element serves as a workspace configuration template;
it is used to create the initial workspace if there's no workspace yet
and for creating additional workspaces through the api
-->
<!ELEMENT Workspace (FileSystem,PersistenceManager,SearchIndex?)>
<!ATTLIST Workspace name CDATA #REQUIRED>
<!--
the PersistenceManager element configures the persistence manager
to be used for the workspace; the class attribute specifies the
FQN of the class implementing the PersistenceManager interface
-->
<!ELEMENT PersistenceManager (param*)>
<!ATTLIST PersistenceManager class CDATA #REQUIRED>
<!--
the SearchIndex element specifies the locaction of the search index
(used by the QueryHandler); the class attribute specifies the
FQN of the class implementing the QueryHandler interface.
-->
<!ELEMENT SearchIndex (param*,FileSystem?)>
<!ATTLIST SearchIndex class CDATA #REQUIRED>
<!--
the Versioning element configures the persistence manager
to be used for persisting version state
-->
<!ELEMENT Versioning (FileSystem, PersistenceManager)>
<!ATTLIST Versioning rootPath CDATA #REQUIRED>
<!--
the Cluster element configures the optional participation of this
repository in a clustered environment. a literal id may be
specified that uniquely identifies this node in a cluster, as well
as the delay in seconds before changes to the journal are
automatically detected.
-->
<!ELEMENT Cluster (Journal)>
<!ATTLIST Cluster id CDATA #IMPLIED
syncDelay CDATA #IMPLIED>
<!--
the Journal element configures the journal used in clustering; the
class attribute specifies the FQN of the class implementing the
Journal interface.
-->
<!ELEMENT Journal (param*)>
<!ATTLIST Journal class CDATA #REQUIRED>
]>
<!-- Example Repository Configuration File -->
<Repository>
<!--
virtual file system where the repository stores global state
(e.g. registered namespaces, custom node types, etc.)
-->
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/repository"/>
</FileSystem>
<!--
security configuration
-->
<Security appName="Jackrabbit">
<!--
access manager:
class: FQN of class implementing the AccessManager interface
-->
<AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
<!-- <param name="config" value="${rep.home}/access.xml"/> -->
</AccessManager>
</Security>
<!--
location of workspaces root directory and name of default workspace
-->
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
<!--
workspace configuration template:
used to create the initial workspace if there's no workspace yet
-->
<Workspace name="${wsp.name}">
<!--
virtual file system of the workspace:
class: FQN of class implementing FileSystem interface
-->
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}"/>
</FileSystem>
<!--
persistence manager of the workspace:
class: FQN of class implementing PersistenceManager interface
-->
<PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
<!-- <PersistenceManager class="com.day.jsr170.persistence.bdb.BDbPersistenceManager">
<PersistenceManager class="com.day.jackrabbit.persistence.jdbc.HSQLDbPersistenceManager">
<param name="driver" value="org.hsqldb.jdbcDriver"/>
<param name="url" value="jdbc:hsqldb:file:${wsp.home}/db/itemState"/>
<param name="user" value="sa"/>
<param name="password" value=""/>
</PersistenceManager> -->
<!--
Search index and the file system it uses.
-->
<!-- Support for JCR 0.16.4.1
Uncomment this when shifting to JCR 0.16.4.1 -->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="useCompoundFile" value="true"/>
<param name="minMergeDocs" value="1000"/>
<param name="maxMergeDocs" value="100000"/>
<param name="mergeFactor" value="10"/>
<param name="bufferSize" value="10"/>
<param name="path" value="${wsp.home}/index"/>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}/index"/>
</FileSystem>
</SearchIndex>
<!--
<SearchIndex class="org.apache.jackrabbit.core.search.lucene.SearchIndex">
<param name="useCompoundFile" value="true"/>
<param name="minMergeDocs" value="1000"/>
<param name="maxMergeDocs" value="10000"/>
<param name="mergeFactor" value="10"/>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}/index"/>
</FileSystem>
</SearchIndex>
-->
</Workspace>
<!--
Configures the versioning
-->
<Versioning rootPath="${rep.home}/version">
<!--
Configures the filesystem to use for versioning ofr the respective
persistence manager
-->
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/version"/>
</FileSystem>
<!--
Configures the perisistence manager to use for the versioning.
Please note, that the current versioning implementation is based on
a 'normal' persistence manager, but this could change in future
implementations.
-->
<PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
<!-- <PersistenceManager class="com.day.jackrabbit.persistence.jdbc.HSQLDbPersistenceManager">
<param name="driver" value="org.hsqldb.jdbcDriver"/>
<param name="url" value="jdbc:hsqldb:file:${rep.home}/version/version"/>
<param name="user" value="sa"/>
<param name="password" value=""/>
</PersistenceManager>-->
</Versioning>
<!--
Search index for content that is shared repository wide
(/jcr:system tree, contains mainly versions)
The same parameters are supported as in the search index configuration
inside the workspace definition element.
This element is optional. If omitted, the /jcr:system tree will not be
indexed and no results will be returned for that tree!
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/repository/index"/>
</SearchIndex>
<Cluster id="node1">
<Journal class="org.apache.jackrabbit.core.journal.FileJournal">
<param name="revision" value="${rep.home}/revision.log" />
<param name="directory" value="${rep.home}/../shared" />
</Journal>
</Cluster>
</Repository>