You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Brian Thompson <BT...@sewardinc.com> on 2007/01/25 21:27:55 UTC

Database Connection Timeouts Using SimpleDbPersistenceManager

Hello,
 
I'm using Jackrabbit in a project running on Tomcat.  It's using
SimpleDbPersistenceManager, connecting to a SQL Server database to
persist nodes.
 
The application works fine until I leave it running idle for more than
half an hour or so - then when I try to reload pages that access the
repository, I get exceptions telling me that the database connection has
been closed!
 
Jackrabbit is being configured via SpringModules for this project.
 
None of the docs I've googled so far mention anything about connection
timeouts.  Has anyone had to deal with this type of thing before?
 
Regards,
 
Brian Thompson
 

Re: Database Connection Timeouts Using SimpleDbPersistenceManager

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

Hibernate is not used in the SimpleDbPersistenceManager and
DatabaseFileSystem. I'm not sure, but I think the auto-reconnect
feature is not implemented in the version you are using. In any case,
if you see the problem again please post the stack trace if possible.

Thomas


On 1/26/07, Brian Thompson <BT...@sewardinc.com> wrote:
> Hi,
>
> It looks like I'm using 1.1.1.  I'll try switching to the latest
> version.
>
> I don't have a stack trace saved, but it was very clearly a
> database-connection-closed error.  There was a mention of Hibernate
> partway down the stack trace, too, so I'm guessing Hibernate is used
> internally by SimpleDbPersistenceManager.
>
> Thanks,
>
> -Brian
>
>
>
> -----Original Message-----
> From: Thomas Mueller [mailto:thomas.tom.mueller@gmail.com]
> Sent: Friday, January 26, 2007 3:08 AM
> To: users@jackrabbit.apache.org
> Subject: Re: Database Connection Timeouts Using
> SimpleDbPersistenceManager
>
> Hi,
>
> The current version of Jackrabbit should actually re-connect to the
> database automatically. Which version do you use? What is the stack
> trace?
>
> Thomas
>
>
> On 1/26/07, Java Prog <ja...@gmail.com> wrote:
> > Similar issue arises for MySQL. Jackrabbit uses only on connection to
> > the DB that is established at the startup. Some databases drop that
> > connection after a period of time if connection is idle.
> > I have created timer task that add simple node, remove it and call
> > session.save() (to actually call DB). Task is executed in the period
> > that is lesser than database idle timeout.
> > It works fast, and keep connection alive.
> >
> > Regardas,
> > J
> >
> > On 1/25/07, Brian Thompson <BT...@sewardinc.com> wrote:
> > > Hello,
> > >
> > > I'm using Jackrabbit in a project running on Tomcat.  It's using
> > > SimpleDbPersistenceManager, connecting to a SQL Server database to
> > > persist nodes.
> > >
> > > The application works fine until I leave it running idle for more
> > > than half an hour or so - then when I try to reload pages that
> > > access the repository, I get exceptions telling me that the database
>
> > > connection has been closed!
> > >
> > > Jackrabbit is being configured via SpringModules for this project.
> > >
> > > None of the docs I've googled so far mention anything about
> > > connection timeouts.  Has anyone had to deal with this type of thing
> before?
> > >
> > > Regards,
> > >
> > > Brian Thompson
>

RE: Database Connection Timeouts Using SimpleDbPersistenceManager

Posted by Brian Thompson <BT...@sewardinc.com>.
Hi,

It looks like I'm using 1.1.1.  I'll try switching to the latest
version.

I don't have a stack trace saved, but it was very clearly a
database-connection-closed error.  There was a mention of Hibernate
partway down the stack trace, too, so I'm guessing Hibernate is used
internally by SimpleDbPersistenceManager.

Thanks,

-Brian



-----Original Message-----
From: Thomas Mueller [mailto:thomas.tom.mueller@gmail.com] 
Sent: Friday, January 26, 2007 3:08 AM
To: users@jackrabbit.apache.org
Subject: Re: Database Connection Timeouts Using
SimpleDbPersistenceManager

Hi,

The current version of Jackrabbit should actually re-connect to the
database automatically. Which version do you use? What is the stack
trace?

Thomas


On 1/26/07, Java Prog <ja...@gmail.com> wrote:
> Similar issue arises for MySQL. Jackrabbit uses only on connection to 
> the DB that is established at the startup. Some databases drop that 
> connection after a period of time if connection is idle.
> I have created timer task that add simple node, remove it and call
> session.save() (to actually call DB). Task is executed in the period 
> that is lesser than database idle timeout.
> It works fast, and keep connection alive.
>
> Regardas,
> J
>
> On 1/25/07, Brian Thompson <BT...@sewardinc.com> wrote:
> > Hello,
> >
> > I'm using Jackrabbit in a project running on Tomcat.  It's using 
> > SimpleDbPersistenceManager, connecting to a SQL Server database to 
> > persist nodes.
> >
> > The application works fine until I leave it running idle for more 
> > than half an hour or so - then when I try to reload pages that 
> > access the repository, I get exceptions telling me that the database

> > connection has been closed!
> >
> > Jackrabbit is being configured via SpringModules for this project.
> >
> > None of the docs I've googled so far mention anything about 
> > connection timeouts.  Has anyone had to deal with this type of thing
before?
> >
> > Regards,
> >
> > Brian Thompson

Re: Database Connection Timeouts Using SimpleDbPersistenceManager

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

The current version of Jackrabbit should actually re-connect to the
database automatically. Which version do you use? What is the stack
trace?

Thomas


On 1/26/07, Java Prog <ja...@gmail.com> wrote:
> Similar issue arises for MySQL. Jackrabbit uses only on connection to
> the DB that is established at the startup. Some databases drop that
> connection after a period of time if connection is idle.
> I have created timer task that add simple node, remove it and call
> session.save() (to actually call DB). Task is executed in the period
> that is lesser than database idle timeout.
> It works fast, and keep connection alive.
>
> Regardas,
> J
>
> On 1/25/07, Brian Thompson <BT...@sewardinc.com> wrote:
> > Hello,
> >
> > I'm using Jackrabbit in a project running on Tomcat.  It's using
> > SimpleDbPersistenceManager, connecting to a SQL Server database to
> > persist nodes.
> >
> > The application works fine until I leave it running idle for more than
> > half an hour or so - then when I try to reload pages that access the
> > repository, I get exceptions telling me that the database connection has
> > been closed!
> >
> > Jackrabbit is being configured via SpringModules for this project.
> >
> > None of the docs I've googled so far mention anything about connection
> > timeouts.  Has anyone had to deal with this type of thing before?
> >
> > Regards,
> >
> > Brian Thompson
> >
> >
> >
>

Re: Database Connection Timeouts Using SimpleDbPersistenceManager

Posted by Java Prog <ja...@gmail.com>.
Similar issue arises for MySQL. Jackrabbit uses only on connection to
the DB that is established at the startup. Some databases drop that
connection after a period of time if connection is idle.
I have created timer task that add simple node, remove it and call
session.save() (to actually call DB). Task is executed in the period
that is lesser than database idle timeout.
It works fast, and keep connection alive.

Regardas,
J

On 1/25/07, Brian Thompson <BT...@sewardinc.com> wrote:
> Hello,
>
> I'm using Jackrabbit in a project running on Tomcat.  It's using
> SimpleDbPersistenceManager, connecting to a SQL Server database to
> persist nodes.
>
> The application works fine until I leave it running idle for more than
> half an hour or so - then when I try to reload pages that access the
> repository, I get exceptions telling me that the database connection has
> been closed!
>
> Jackrabbit is being configured via SpringModules for this project.
>
> None of the docs I've googled so far mention anything about connection
> timeouts.  Has anyone had to deal with this type of thing before?
>
> Regards,
>
> Brian Thompson
>
>
>

RE: Database Connection Timeouts Using SimpleDbPersistenceManager

Posted by Brian Thompson <BT...@sewardinc.com>.
-----Original Message-----
From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] 
Sent: Friday, January 26, 2007 3:38 AM
To: users@jackrabbit.apache.org
Subject: Re: Database Connection Timeouts Using
SimpleDbPersistenceManager

hi brian,

mysql is known to drop idle connections. i haven't heard anything
regarding mssql automatically dropping idle connections. is the
connection obtained from a connection pool?

anyway, as thomas already mentioned, the current version of jackrabbit
should automatically try to recover from a connection loss.

could you please send us your configuration
(repository.xml/workspace.xml) and the jackrabbit version you're using?

cheers
stefan

================================

Hi Stefan,

I've copied my repository.xml and workspace.xml at the bottom of this
email.  As I mentioned in my reply to Thomas, I was using Jackrabbit
1.1.1.

I also updated my application to Jackrabbit 1.2.1; I will be testing it
for database connection timeouts later today.

Thanks,

Brian



<?xml version="1.0"?>
<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.db.DbFileSystem">
        <param name="path" value="${rep.home}/repo"/>
		<param name="driver"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
		<param name="url"
value="jdbc:sqlserver://server:1433;databaseName=projectDb"/>
		<param name="schema" value="mssql"/>
		<param name="user" value="username"/>
		<param name="password" value="password"/>
		<param name="schemaObjectPrefix" value="rep_"/>
    </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>

        <LoginModule
class="org.apache.jackrabbit.core.security.SimpleLoginModule">
           <!-- anonymous user name ('anonymous' is the default value)
-->
           <param name="anonymousId" value="anonymous"/>
           <!--
              default user name to be used instead of the anonymous user
              when no login credentials are provided (unset by default)
           -->
           <!-- <param name="defaultUserId" value="superuser"/> -->
        </LoginModule>
    </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 the FileSystem interface
        -->
		<FileSystem
class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
	        <param name="path" value="${wsp.home}"/>
			<param name="driver"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
			<param name="url"
value="jdbc:sqlserver://server:1433;databaseName=projectDb"/>
			<param name="schema" value="mssql"/>
			<param name="user" value="username"/>
			<param name="password" value="password"/>
			<param name="schemaObjectPrefix" value="wsk_"/>
		</FileSystem>
        <!--
            persistence manager of the workspace:
            class: FQN of class implementing the PersistenceManager
interface
        -->
		<PersistenceManager
class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
			<param name="driver"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
			<param name="url"
value="jdbc:sqlserver://server:1433;databaseName=projectDb"/>
			<param name="schema" value="mssql"/>
			<param name="user" value="username"/>
			<param name="password" value="password"/>
        	<param name="schemaObjectPrefix" value="${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">
        <!--
            Configures the filesystem to use for versioning for the
respective
            persistence manager
        -->
		<FileSystem
class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
			<param name="driver"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
			<param name="url"
value="jdbc:sqlserver://server:1433;databaseName=projectDb"/>
			<param name="schema" value="mssql"/>
			<param name="user" value="username"/>
			<param name="password" value="password"/>
			<param name="schemaObjectPrefix" value="ver_"/>
		</FileSystem>
        
        <!--
            Configures the persistence manager to be used for persisting
version state.
            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.db.SimpleDbPersistenceManager">
			<param name="driver"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
			<param name="url"
value="jdbc:sqlserver://server:1433;databaseName=projectDb"/>
			<param name="schema" value="mssql"/>
			<param name="user" value="username"/>
			<param name="password" value="password"/>
        	<param name="externalBLOBs" value="false"/>
			<param name="schemaObjectPrefix"
value="version_"/>
        </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}/repo/index"/>
    </SearchIndex>
</Repository> 



<?xml version="1.0" encoding="UTF-8"?>
<Workspace name="default">
        <!--
            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="path" value="${wsp.home}"/>
			<param name="driver"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
			<param name="url"
value="jdbc:sqlserver://server:1433;databaseName=projectDb"/>
			<param name="schema" value="mssql"/>
			<param name="user" value="username"/>
			<param name="password" value="password"/>
			<param name="schemaObjectPrefix" value="wsk_"/>
		</FileSystem>
        <!--
            persistence manager of the workspace:
            class: FQN of class implementing the PersistenceManager
interface
        -->
		<PersistenceManager
class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
			<param name="driver"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
			<param name="url"
value="jdbc:sqlserver://server:1433;databaseName=projectDb"/>
			<param name="schema" value="mssql"/>
			<param name="user" value="username"/>
			<param name="password" value="password"/>
        	<param name="schemaObjectPrefix" value="${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>

Re: Database Connection Timeouts Using SimpleDbPersistenceManager

Posted by Stefan Guggisberg <st...@gmail.com>.
hi brian,

On 1/25/07, Brian Thompson <BT...@sewardinc.com> wrote:
> Hello,
>
> I'm using Jackrabbit in a project running on Tomcat.  It's using
> SimpleDbPersistenceManager, connecting to a SQL Server database to
> persist nodes.
>
> The application works fine until I leave it running idle for more than
> half an hour or so - then when I try to reload pages that access the
> repository, I get exceptions telling me that the database connection has
> been closed!
>
> Jackrabbit is being configured via SpringModules for this project.
>
> None of the docs I've googled so far mention anything about connection
> timeouts.  Has anyone had to deal with this type of thing before?

mysql is known to drop idle connections. i haven't heard anything
regarding mssql automatically dropping idle connections. is the connection
obtained from a connection pool?

anyway, as thomas already mentioned, the current version of jackrabbit
should automatically try to recover from a connection loss.

could you please send us your configuration (repository.xml/workspace.xml)
and the jackrabbit version you're using?

cheers
stefan

>
> Regards,
>
> Brian Thompson
>
>
>