On Wed, Aug 22, 2018 at 7:23 AM, jokuja <jozefkut...@gmail.com> wrote:
> I am trying to run app on tomcat7 on windows which uses jackrabbit and from
> some reason persistence manager cannot be instantiated - I think the reason
> is that it cannot connect to mysql database.
> But I can connect to this database in other web-app on the same tomcat with
> the same credentials.

If so, I'd recommend you to configure JNDI DataSource in tomcat level
[1], and try to connect the database through the JNDI resource in both
applications.
In Jackrabbit repository configuration [2], you can add <DataSources>
and <DataSource> elements to refer to the JNDI DataSource defined in
the container, without having to specify credentials in
repository.xml. BTW, you should look into and update workspace.xml
files under the repository directory if your repository.xml change
needs to affect that.

For example,

<Repository>

  <DataSources>
    <DataSource name="repositoryDS">
      <param name="driver" value="javax.naming.InitialContext"/>
      <param name="url" value="java:comp/env/jdbc/repositoryDS"/>
      <param name="databaseType" value="mysql"/>
    </DataSource>
  </DataSources>

  <!-- SNIP -->

  <Workspace name="${wsp.name}">

    <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
      <param name="dataSourceName" value="repositoryDS"/>
      <param name="schemaObjectPrefix" value="${wsp.name}_"/>
    </FileSystem>

    <PersistenceManager
class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
      <param name="dataSourceName" value="repositoryDS"/>
      <!-- SNIP -->
    </PersistenceManager>

    <!-- SNIP -->

  </Workspace>

  <Versioning rootPath="${rep.home}/version">

    <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
      <param name="dataSourceName" value="repositoryDS"/>
      <param name="schemaObjectPrefix" value="version_"/>
    </FileSystem>

    <PersistenceManager
class="org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager">
      <param name="dataSourceName" value="repositoryDS"/>
      <!-- SNIP -->
    </PersistenceManager>

    <!-- SNIP -->

  </Versioning>

  <!-- SNIP -->

  <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
    <param name="dataSourceName" value="repositoryDS"/>
    <!-- SNIP -->
  </DataStore>

  <!-- SNIP -->

</Repository>

Regards,

Woonsan

[1] 
https://tomcat.apache.org/tomcat-8.5-doc/jndi-resources-howto.html#JDBC_Data_Sources
[2] http://jackrabbit.apache.org/jcr/jackrabbit-configuration.html

Reply via email to