Version 3

    It is often the case that you may want to create a copy of the whole JBoss AS instance containing GateIn.

     

     

    That doesn't quite work with default configuration, since it's saved in JCR repository (database). This configuration includes some absolute filesystem paths. So, when you start up another copy of JBoss AS it reads the configuration data from JCR, as prepared by the first instance, and tries to use the same directory locations. When GateIn is copied to another system that will cause FileNotFoundException. When copied to another location on the same system it will cause both instances to share data, which normally is not what you want - you want them to be completely separate.

     

     

    The way to solve this is to prevent GateIn from storing / reading these configurations from JCR repository. This can be done by disabling the JCR repository’s configuration persister.

     

     

    Open and edit server/default/deploy/gatein.ear/02portal.war/WEB-INF/conf/jcr/jcr-configuration.xml

     

     

    Change the following section:


    {code:xml}

    <component>

        <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>

        <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>

        <init-params>

          <value-param>

            <name>conf-path</name>

            <description>JCR configuration file</description>

            <value>war:/conf/jcr/repository-configuration.xml</value>

          </value-param>

          <properties-param>

            <name>working-conf</name>

            <description>working-conf</description>

            <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>

            <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>

            <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>

          </properties-param>

        </init-params>

      </component>

    {code}

     

     

     

    To become like:

     

    {code:xml}

    <component>

        <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>

        <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>

        <init-params>

          <value-param>

            <name>conf-path</name>

            <description>JCR configuration file</description>

            <value>war:/conf/jcr/repository-configuration.xml</value>

          </value-param>

          <!-- THIS IS THE CONFIG OF THE CONFIG PERSISTER-->

          <!--properties-param>

            <name>working-conf</name>

            <description>working-conf</description>

            <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>

            <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>

            <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>

          </properties-param-->

        </init-params>

      </component>

     

    {code}

     

     

    If you do this on your original GateIn instance before starting it for the first time, then this might be all that is required.

     

     

    But if you already have a prepared GateIn instance with configuration stored in JCR repository, then another way to fix the problem is to drop JCR_CONFIG table from your JCR repository database and restart GateIn. In this case GateIn will reread the configuration from file.

     

    Alternative: Using Configuration Override

     

    GateIn comes with two portal containers deployed by default. One by the name 'portal', and another by the name 'sample-portal'. There is a configuration override mechanism that allows us to override each portal container's configuration without editing any deployed files (anything under gatein.ear, or anything within gatein-sample-portal.ear). In order to override 'portal' portal container's configuration we place configuration files in

    server/default/conf/gatein/portal/portal directory. For overriding 'sample-portal' portal container's configuration we use server/default/conf/gatein/portal/sample-portal directory.

     

    In order to achieve the same result as above we do the following.

     

    Create server/default/conf/gatein/portal/portal directory. Create in it a file called configuration.xml with the following content:

     

    {code:xml}

    <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

              xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"

              xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">

    <component>

        <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>

        <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>

        <init-params>

          <value-param>

            <name>conf-path</name>

            <description>JCR configuration file</description>

            <!--value>war:/conf/jcr/repository-configuration.xml</value-->

            <value>${jboss.server.config.url}/${exo.conf.dir.name}/portal/portal/jcr/repository-configuration.xml</value>

          </value-param>

          <!-- THIS IS THE CONFIG OF THE CONFIG PERSISTER-->

          <!--properties-param>

            <name>working-conf</name>

            <description>working-conf</description>

            <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>

            <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>

            <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>

          </properties-param-->

        </init-params>

      </component>

    </configuration>

     

    {code}

     

     

    Create a subdirectory called jcr. Copy /server/default/deploy/gatein.ear/02portal.war/WEB-INF/conf/jcr/repository-configuration.xml into /server/default/conf/gatein/portal/portal/jcr.

     

    The 'portal' portal container's configuration is now overriden. JCR repository configuration will now be loaded from /server/default/conf/gatein/portal/portal/jcr/repository-configuration.xml which is outside the deployed archive.

     

    Now we do the same for 'sample-portal' portal container.

     

    Create server/default/conf/gatein/portal/sample-portal directory. Create in it a file called configuration.xml with the following content:


    {code:xml}

    <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

              xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"

              xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">

    <component>

        <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>

        <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>

        <init-params>

          <value-param>

            <name>conf-path</name>

            <description>JCR configuration file</description>

            <!--value>war:/conf/jcr/repository-configuration.xml</value-->

            <value>${jboss.server.config.url}/${exo.conf.dir.name}/portal/sample-portal/jcr/repository-configuration.xml</value>

          </value-param>

          <!-- THIS IS THE CONFIG OF THE CONFIG PERSISTER-->

          <!--properties-param>

            <name>working-conf</name>

            <description>working-conf</description>

            <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>

            <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>

            <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>

          </properties-param-->

        </init-params>

      </component>

    </configuration>

     

    {code}

     

     

    Create a subdirectory called jcr. Extract file /server/default/deploy/gatein-sample-portal.ear/sample-portal.war/WEB-INF/conf/sample-portal/jcr/repository-configuration.xml into /server/default/conf/gatein/portal/sample-portal/jcr. And you're done.

     

    This kind of configuration override allows you to prepare your customizations in a JBoss AS instance that you use with GateIn packaging, so that you don't have to reapply your customizations after every new rebuild.