You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Guillaume Belrose <ka...@gmail.com> on 2012/04/24 15:37:37 UTC

Default behaviour of Apache Jackrabbit in the face of MySQL connection failures.

Hi,

I am using Jackrabbit core version 2.2.10 with a MySQL 5.5. database
on Windows 7. I am trying to understand the behaviour of JackRabbit
following a database connection failure. Currently, following a DB
connection failure, Jackrabbit enters into an error recovery mode
which carries on until it eventually manages to reconnect to the
database. If there a way to disable this recovery mechanism or to
control how many times it should attempt to reconnect before giving
up?

I want to be able to "catch" database errors early and report them to
the user, and I don't want Jackrabbit to try to reconnect as this
would be handled somewhere else in my application.

Many thanks,

Guillaume.

PS: here is my xml config file:

<?xml version="1.0"?>
	<!--
		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.
	-->

<!DOCTYPE Repository
          PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN"
          "http://jackrabbit.apache.org/dtd/repository-2.0.dtd">

	<!--
		Example Repository Configuration File Used by -
		org.apache.jackrabbit.core.config.RepositoryConfigTest.java -
	-->
<Repository>
	<DataSources>
        <DataSource name="datasource">
			<param name="driver" value="com.mysql.jdbc.Driver" />
			<param name="url" value="jdbc:mysql://localhost:${databasePort}/jcr" />
			<param name="user" value="quantel" />
			<param name="password" value="" />
			<param name="databaseType" value="mysql"/>
            <param name="validationQuery" value="select 1"/>
        </DataSource>
    </DataSources>


	<!--
		virtual file system where the repository stores global state (e.g.
		registered namespaces, custom node types, etc.)
	-->
	<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
		<param name="dataSourceName" value="datasource" />
		<param name="schemaObjectPrefix" value="fs_" />
	</FileSystem>

	<!--
        security configuration
    -->
    <Security appName="Jackrabbit">
        <!--
            security manager:
            class: FQN of class implementing the
JackrabbitSecurityManager interface
        -->
        <SecurityManager
class="org.apache.jackrabbit.core.DefaultSecurityManager"
workspaceName="security">
	  		<WorkspaceAccessManager
class="org.apache.jackrabbit.core.security.simple.SimpleWorkspaceAccessManager"></WorkspaceAccessManager>
            <!-- <param name="config" value="${rep.home}/security.xml"/> -->
        </SecurityManager>

        <!--
            access manager:
            class: FQN of class implementing the AccessManager interface
        -->
        <AccessManager
class="org.apache.jackrabbit.core.security.DefaultAccessManager">
            <!-- <param name="config" value="${rep.home}/access.xml"/> -->
        </AccessManager>

        <LoginModule
class="org.apache.jackrabbit.core.security.authentication.DefaultLoginModule">
           <!--
              anonymous user name ('anonymous' is the default value)
            -->
           <param name="anonymousId" value="anonymous"/>
           <!--
              administrator user id (default value if param is missing
is 'admin')
            -->
           <param name="adminId" value="system"/>
           <!--
              optional parameter 'principalProvider'.
              the value refers to the class name of the
PrincipalProvider implementation.
           -->
           <!-- <param name="principalProvider" value="..."/> -->
        </LoginModule>
    </Security>
	<!--
		location of workspaces root directory and name of default workspace
	-->
	<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="security" />

	<!--
		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 the FileSystem interface
		-->
		<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
			<param name="dataSourceName" value="datasource" />
			<param name="schemaObjectPrefix" value="fs_${wsp.name}_" />
		</FileSystem>

		<!--
			persistence manager of the workspace: class: FQN of class
			implementing the PersistenceManager interface
		-->
		<PersistenceManager
			class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
			<param name="dataSourceName" value="datasource" />
			<param name="schemaObjectPrefix" value="pm_${wsp.name}_" />
			<param name="externalBLOBs" value="false" />
		</PersistenceManager>
		<!--
			Search index and the file system it uses. class: FQN of class
			implementing the QueryHandler interface
		-->
		<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
			<param name="path" value="${wsp.home}/index" />
		</SearchIndex>
	</Workspace>

	<!--
        Configures the versioning
    -->
	<Versioning rootPath="${rep.home}/version">
		<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
			<param name="dataSourceName" value="datasource" />
			<param name="schemaObjectPrefix" value="fs_version_" />
		</FileSystem>

		<PersistenceManager
			class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
			<param name="dataSourceName" value="datasource" />
			<param name="schemaObjectPrefix" value="pm_version_" />
			<param name="externalBLOBs" value="false" />
		</PersistenceManager>
	</Versioning>
	<!--
		Search index for content that is shared repository wide (/jcr:system
		tree, contains mainly versions)
	-->
	<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
		<param name="path" value="${rep.home}/repository/index" />
	</SearchIndex>
</Repository>