Technical FAQ Jahia 5

Jahia 5 Configuration FAQ

Jahia 5 Configuration FAQ

  • How do I configure Jahia with MySQL ?
    If you are installing Jahia with MySQL (all plateforms), you will have to force creation of new tables in InnoDB format instead of MyISAM. Under Windows, you can do this while installing MySQL, by selecting the InnoDB table format. Under other plateforms, the best way to ensure this is to change the settings of MySQL in the configuration file (my.cnf/my.ini) to set the default type for new tables to InnoDB before installing Jahia.
    Edit the my.cnf(Unix/Linux) or my.ini(windows) and add the following line in the [mysqld] part of the file :

    default-table-type=InnoDB

    If your MySQL database server runs under Unix/Linux, you will also need to change a default setting to allow case-insensitive SQL requests. Under Windows and MacOSX, case-insensitive SQL requests are activated by default, but not under Unix/Linux, so you need to edit the my.cnf configuration file of MySQL and add the following statement in the [mysqld] part of the file :

    lower_case_table_names=1

    Then restart your MySQL instance. You can now install Jahia

  • How to configure a LDAP connexion ?

    To connect to a LDAP server, you need to modify 4 xml files, 2 for users and 2 for groups.

    The 2 files where you configure the connexion to the LDAP server for the users and the groups are users.ldap.properties and groups.ldap.properties. They are both located in the following directory :

    TOMCAT_HOME/webapps/jahia/WEB-INF/etc/ldap/

    The following parameters of the users.ldap.properties should be set :

    users.ldap.url
    users.ldap.authentification.mode
    users.ldap.public.bind.dn

    If your LDAP server requires that you authentify before you can browse the repository, uncomment and set the folowing property :

    users.ldap.public.bind.password

    You also need to map the jahia users properties (username, e-mail, etc...) to the corresponding LDAP attributes by modifying the following parameters :

    users.ldap.username.attribute.map
    users.ldap.firstname.attribute.map
    users.ldap.lastname.attribute.map
    users.ldap.email.attribute.map
    users.ldap.organization.attribute.map

    You need to modify similar parameters in the groups.ldap.properties if you want to use LDAP groups inside Jahia.
    Once this is done, you need to activate the LDAP connexion in Jahia by uncommenting some parts in the file TOMCAT_HOME/webapps/jahia/WEB-INF/etc/services/usermanager/applicationcontext-services.xml.

    For connecting users to LDAP, uncomment the following parts :

        <!--
        <bean id="JahiaUserManagerLDAPProvider"
    class="org.jahia.services.usermanager.JahiaUserManagerLDAPProvider"
    parent="jahiaServiceTemplate" factory-method="getInstance">
            <property name="cacheService">
                <ref bean="JahiaCacheService"/>
            </property>
            <property name="key">
                <value>ldap</value>
            </property>
            <property name="defaultProvider">
              <value>false</value>
            </property>
            <property name="readOnly">
              <value>true</value>
            </property>
            <property name="priority">
              <value>2</value>
            </property>
        </bean>
        -->

    and lower :

    <!--
    <entry>
        <key><value>ldap</value></key>
       <ref bean="JahiaUserManagerLDAPProvider" />
      </entry>
    -->

    For connecting groups to LDAP, uncomment the following part :

        <!--
        <bean id="JahiaGroupManagerLDAPProvider"
    class="org.jahia.services.usermanager.JahiaGroupManagerLDAPProvider"
    parent="jahiaServiceTemplate" factory-method="getInstance">
            <property name="cacheService">
                <ref bean="JahiaCacheService"/>
            </property>
            <property name="incrementorService">
                <ref bean="JahiaIncrementorsDBService"/>
            </property>
            <property name="key">
                <value>ldap</value>
            </property>
            <property name="defaultProvider">
              <value>false</value>
            </property>
            <property name="readOnly">
              <value>true</value>
            </property>
            <property name="priority">
              <value>2</value>
            </property>
        </bean>
        -->

    and also :

    <!--
    <entry>
    <key><value>ldap</value></key>
      <ref bean="JahiaGroupManagerLDAPProvider" />
    </entry>
    -->

    Restart Jahia, login as site administrator (or root) and go in the "manage user" menu in the Administration panel of Jahia. Select "ldap" in the providers list and click on "Search". You should see the list of users from your LDAP repository.



  • How to remove /jahia/Jahia from the URL ?

    You can find documentation on how to remove /jahia/Jahia from the URL in README file included in the Jahia distribution, under the "Changing jahia/Jahia guide" section.



  • How to run Jahia as a Windows service ?
    To install Jahia as a Windows service, you first need to install a separate tomcat instance from the Windows Service Installer package available on the Tomcat website. When installing Tomcat from this package, select the "NT Service" option.

    Once Tomcat is installed, you can copy the "jahia" webapps directory from the Jahia distribution inside the "webapps" directory of the Tomcat instance you installed. You will also need to copy the server.xml and web.xml files located in the "TOMCAT_HOME/conf/" directory of the Jahia distribution over the files provided with the standard Tomcat package. You will also need to copy the file jahia.xml from the "TOMCAT_HOME/conf/Catalina/localhost" directory. Also copy the files in "TOMCAT_HOME/shared/lib" and "TOMCAT_HOME/shared/classes". And finally, copy whatever web applications you are using from your Tomcat webapps directory to the new Tomcat service installation.

    You can now launch the Apache Tomcat service from the service manager of Windows and access the Jahia Configuration Wizard through http://myserver:8080/jahia/Jahia.

    If you want to change the values of the Java heap size (XMS and XMX values used to specify the minimal and maximal size allocated to the Java process), you need to modify the Windows registry.


    Open the registry Editor and go to :

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ApacheTomcat\Parameters
    You should have some "JVM Option Number x" values already set.

    If for example the last JVM Option Number is 2, add a new string value with a value name "JVM Option Number 3" and set the value data to "-Xms128m". This sets the initial Java heap size to 128MB. Add a second string value "JVM Option Number 3" and set the value data to "-Xmx512m". This sets the maximum Java heap size to 512MB.

    Finally, modify the "JVM Option Count" parameter and set it to the actual number of "JVM Option Number" listed. In our example, we added 2 JVM Option to the 3 already existing, so we would need to change the JVM Option Count from 3 to 5.

  • How to improve database performance ?

    Jahia 5 comes pre-optimized for most usage scenarios, creating indexes automatically for all the primary and foreign keys. But there are always special use cases, especially when developing templates that make heavy usage of filters and sorters, where further optimization of the database can be useful. As these combinations are customized by integrators and/or template developers, we cannot offer indexes for all cases.

    For these cases, we recommend you use a database profiling tool, such as our own SQL Profiler to create your own set of indexes. This tool will allow you analyze all queries that are sent from Jahia to the database and will create an index file that you can import in your database. This way you create indexes which best suit the data you have in your database. You might find other profiler such as OptimizeIt that can also track JDBC requests.



  • How to change the debugging log level ?
    Jahia make use of the Log4J library for all debugging infos. Log4J defines some logging levels as follows (from the more to the less verbose) :

    ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF
    By default, point releases of Jahia (as opposed to CVS builds) have the log levels of most parts set to INFO. If you want to increase the log level to trace a problem, you will need to modify the log4j.xml file located in the following directory :

    TOMCAT_HOME/webapps/jahia/WEB-INF/etc/config/
    At the bottom of the file, you have the <root>... </root> part. Change the <priority value="info"/> to <priority value="debug"/> for example to have more debugging information in the console. You can also change this parameter for some specific part of Jahia like Slide or pdfbox. You can even add your own logger on a specific set of classes, for example :
    <category name="org.apache.axis"> <priority value="info"/> </category>
    Don't forget to change back the values to INFO, as DEBUG log level has a pretty important impact on performance.

  • How to avoid restarting Jahia after changing a user's password with LDAP ?
    When a LDAP user change his password, it's not effective in Jahia because Jahia use the password of the last session of the person store in cache. So you need to restart your server to take the change into consideration.

    Here is how you can change the code of the JahiaLDAPUser class to redirect the test to check again the LDAP password if the first test is wrong and clean the caches at the same time.
     

    public boolean verifyPassword (String password) {

             if (password != null) {
                 boolean localLoginResult = false;
                 if (!"".equals(mPassword)) {
                     String test = JahiaUserManagerService.encryptPassword
    (password);
                     localLoginResult = mPassword.equals (test);
                 }
                 //test the provided password with the internal memory
    encrypted password.
                 if(localLoginResult){
                     //both passwords match.
                     return true;
                 }else{
                     //the local encrypted password does not match the one
    in parameter
                     //forward to the ldap authN in case of there was a
    ldap password change from the last user's visit.
                     boolean loginResult =
    JahiaUserManagerLDAPProvider.getInstance ().login (mUserKey,
                         password);
                     if (loginResult) {
                             /** @todo here we must now update the
    properties of the user
                             *  since he has access to more of his
    attributes once logged in
                             */
                             mPassword =
    JahiaUserManagerService.encryptPassword
    (password);
                             return true;
                     }
                     /** @todo insert here LDAP connection check... */
                 }
             }
             return false;
         }