Environment SetupJavaTomcat
WebsphereMaven
Sakai Installation
Database Installation
Troubleshooting Issues |
Environment SetupJavaJava Verification, Installation and Environment VariablesSun Microsystem's Java 2 Platform Standard Edition 5.0 (J2SE 5.0), a.k.a Java 1.5, is required to build and run Sakai. Certain files, such as *.jsp and *.jws, require compilation so downloading and attempting to use only the runtime environment (JRE 5.0) will not suffice.
To confirm that Java is both installed on your system and is the correct version for Sakai, run java -version from the command line: $ java -version If Java is installed, the version command will output basic version and build information. Note that Java's "internal" version number will be displayed: java version "1.5.0_18" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_18) Java HotSpot(TM) Client VM (build 1.5.0_18, mixed mode, sharing) If Java is not installed or if you are running the wrong version you can download the latest J2SE 5.0 JDK release from Sun's archive: Release: http://java.sun.com/javase/downloads/index_jdk5.jsp Install the SDK, typically in the /opt directory, i.e. /opt/java.
JAVA environment variablesJava requires two environment variables be set for optimal operation. For UNIX operating systems one typically modifies a startup file like ~/.bash_login to set and export shell variables while Mac users typically set and export environment variables in .bash_profile. For Windows, go to Start -> Control Panel -> System -> Advanced -> Environment Variables and set JAVA_HOME via the GUI (samples below). JAVA_HOMESet the JAVA_HOME environment variable to point to the base directory of your Java installation. Linux/Unix/: export JAVA_HOME=/usr/java/java-current
PATHNext, add Java's /bin directory to the PATH environment variable: Linux/Unix/Mac: export PATH=$PATH:$JAVA_HOME/bin/ You should check that you have set your environment variables correctly. For both Windows XP and Unix/Linux/Mac operating systems start a new shell and run the set command to see your environment variables. $ set [excerpt] JAVA_HOME=/Library/Java/Home JAVA_OPTS='-server -Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=196m -XX:NewSize=192m -XX:MaxNewSize=384m' ... PATH=/Library/Java/Home/bin [etc] .... JVM TuningThe default Java virtual machine is not adequate to run an application of Sakai's size, and several JVM parameters must be increased to a certain threshold for Sakai to run, while some may be further adjusted for optimal performance on your machines.
The standard way to control the JVM options when Tomcat starts up is to have an environment variable JAVA_OPTS defined with JVM startup options. Since any given Sakai instance may be deployed for a variety of purposes - ranging from developers doing private testing to large-scale deployments - it's hard to recommend a single set of such options as the preferred ones for every case. We can, however, start with a bare minimum which will at least avoid "Out of Memory" errors, and be suitable for developer installs of the software: JAVA_OPTS="-server -Xms768m -Xmx768m -XX:PermSize=128m -XX:MaxPermSize=256m -XX:NewSize=192m -XX:MaxNewSize=384m" This is an adequate - if minimal - starting point: it selects server mode, sets an adequate heap size, and sizes the permanent generation to accommodate more longer-persisting objects. These settings will allow things to be functional for testing and development, but for pilot or production deployments you'll want to give closer attention to the appropriate values for your server. See the [Sys Admin Guide] for more detailed tips. Once you set JAVA_OPTS Tomcat will see this environment variable upon startup and use it. Instead of putting this in an environment variable you might create your own startup script to do so. If you choose to run Tomcat as a service, review the [Tomcat Installation and Configuration] section for additional tuning recommendations. HTTP ProxyIn environments where local network policy or firewalls require use of an upstream http proxy/cache, Sakai needs to be configured accordingly. Otherwise components or services which use http requests, such as the BasicNewsService for RSS feeds in the News tool, cannot retrieve data from the target URLs. This can be fixed with the following JAVA_OPTS arguments: export JAVA_OPTS="-Dhttp.proxyHost=cache.some.domain -Dhttp.proxyPort=8080" TomcatApache Tomcat Servlet ContainerThe Apache Tomcat servlet container provides an ideal environment for running Sakai as a web application. Tomcat implements both the Java Servlet and JavaServer Pages (JSP) specifications and can be run in standalone mode or in conjunction with a web application server such as the Apache HTTP server or JBoss. Sakai 2.6.0 was tested using Apache Tomcat 5.5.26. You can learn more about Tomcat by visiting http://tomcat.apache.org/. Download and Install TomcatGetting TomcatTomcat can be downloaded as a binary install from http://archive.apache.org/dist/tomcat/tomcat-5/ Choose the core distribution. Windows users have the option of downloading either a Windows Service Installer .exe or a binary *.zip archive. We recommend the *.zip archive over the installer because configuration and log viewing are easier. You can later convert the .zip install into a service install later by running /bin/service.bat (see below for more details). Unpack the Tomcat archive into your installation directory of choice, e.g. /opt/. Unix/Mac users should create a symbolic link while Windows users should simply rename the base Tomcat directory to /tomcat to simplify the path. ln -s apache-tomcat-5.5.26 tomcat
Sakai - Tomcat GotchasSakai installations should always be accompanied by a fresh install of Tomcat. It provides a clean environment that simplifies troubleshooting if problems are encountered during the startup phase.
-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
Tomcat Environment VariablesBy convention, the base Tomcat directory (e.g. /usr/local/apache-tomcat-5.5.26) is referred to as $CATALINA_HOME. As a convenience, you should set $CATALINA_HOME as an environment variable. For UNIX operating systems one typically modifies a startup file like ~/.bash_login to set and export shell variables while Mac users typically set and export environment variables in .bash_profile. For Windows, go to Start -> Control Panel -> System -> Advanced -> Environment Variables and set your Tomcat environment variables via the GUI. CATALINA_HOMESet the CATALINA_HOME environment variable to point to the base directory of your Tomcat installation. Unix/Mac: export CATALINA_HOME=/opt/tomcat PATHAdd the Tomcat /bin directory to your PATH variable: Unix/Mac: export PATH=$PATH:$CATALINA_HOME/bin Tomcat ConfigurationSakai supports UTF-8 allowing for non-Roman characters, but this requires that Tomcat be configured to accept UTF-8 URLs since it ships with ISO-8859-1 as the default URL encoding. To change this setting, edit $CATALINA_HOME/conf/server.xml. Add the attribute URIEncoding="UTF-8" to the <connector> element. For example: <Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/> If you want to run Tomcat on different ports than the defaults, this would also be a good time to make those changes in the server.xml file. See Tomcat configuration documentation for more details. If you plan to run Tomcat as a standalone web server as opposed to running it in conjunction with the Apache HTTP server then you will want to make a further minor change that may spare some confusion later. The ROOT webapp is the one served up when a request is made to Tomcat's root URL. If you want users to be re-directed automatically to the Sakai application, you must insert an index.html file into /webapps/ROOT that prompts this re-direction. The index.html file should look something like the following: <html> <head> <title>Redirecting to /portal</title> <meta http-equiv="Refresh" content="0:URL=/portal"> </head> <body bgcolor="#ffffff" onLoad="javascript:window.location='/portal';"> <div style="margin:18px;width:288px;background-color:#cccc99;padding:18px;border:thin solid #666600;text-align:justify"> <p style="margin-top:0px"> You are being redirected to the Sakai portal. If you are not automatically redirected, use the link below to continue:<br/> <a href="/portal">Take me to the Sakai portal</a> </p> </body> </html> If you don't make this change you (and your users) will need to append /portal to the URL entered to access Sakai each time. If you intend to connect Tomcat with Apache HTTP server you can configure redirections from within Apache, an option that lies outside the scope of this document. Tomcat Memory SettingsYou can better manage Tomcat memory usage by creating a SETENV file defining JAVA_OPTS environment variable settings in the tomcat/bin directory. Mac/Unix: create a file called setenv.sh and add the following line: export JAVA_OPTS="-server -XX:+UseParallelGC -Xmx768m -XX:MaxPermSize=160m -Djava.awt.headless=true" Windows: create a file called setenv.bat and add the following line: set JAVA_OPTS=-server -XX:+UseParallelGC -Xmx768m -XX:MaxPermSize=160m -Djava.awt.headless=true Tomcat as a Windows ServiceYou can convert the .zip install into a service install by running service.bat from the /bin directory, e.g. C:\tomcat\bin> service.bat install You can add a service name as a second argument to the above script (the default name is "Tomcat5"). You can uninstall the service by replacing "install" with "remove". To open the configuration window, issue the following command: C:\tomcat\bin> tomcat5w //ES//Tomcat5 Replace "Tomcat5" with whatever service name you chose for the install. You'll want to set the service to startup automatically ("Startup Type" under the General tab).
-Xmx768m -Xms768m -XX:PermSize=128m -XX:MaxPermSize=256m Finally, clear out the Initial Memory Pool and Maximum Memory Pool values, as those might conflict with the options you're putting in the Java Options field. Then click Apply, restart the service, and double-check the service manager to verify that the values have changed. WebsphereWebsphere Application Server ContainerAs an alternative to Tomcat, Sakai also supports the IBM Websphere Application Server. Websphere 6.1 is a J2EE 1.4 compliant application server. It supports Java Standard Edition 1.5 and provides an enterprise-level platform for hosting the Sakai CLE in a secure, scalable, and highly available application server environment. To install Websphere, follow these detailed instructions. MavenMaven InstallationSakai uses Apache's Maven build tool to compile and deploy its project modules. There are three steps in the process: clean, install and deploy. These steps, otherwise known as Maven goals, perform the following actions: clean flushes the target for each Sakai project module prior to building For more information on Maven visit http://maven.apache.org/. Download and Install MavenIf you have not installed Maven, download the latest Maven 2.0 build from http://maven.apache.org/download.html and extract the distribution archive into your installation directory of choice, e.g. /opt/maven-2.0.8. Maven Environment VariablesMaven requires that a number of environment variables be set for optimal operation. For UNIX operating systems one typically modifies a startup file like ~/.bash_login to set and export shell variables while Mac users typically set and export environment variables in .bash_profile. For Windows, go to Start -> Control Panel -> System -> Advanced -> Environment Variables and set your Maven environment variables via the GUI. MAVEN_HOMESet the MAVEN_HOME environment variable to point to the base directory of your Maven installation. Unix/Mac: export MAVEN_HOME=/opt/maven-2.0.xx PATHAdd the Maven /bin directory to your PATH variable: Unix/Mac: export PATH=$PATH:$MAVEN_HOME/bin MAVEN_OPTS
export MAVEN_OPTS='-Xms256m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=128m' Create a local Maven RepositoryCreate a local Maven repository (.m2) in your home directory: Unix/Mac cd $HOME mkdir -p .m2/repository Windows mkdir %HOMEDRIVE%%HOMEPATH%\.M2\repository
Create a Maven settings.xml fileCreate a new XML file in your .m2 directory called settings.xml. Add the following lines, specifying the actual location of your Tomcat home directory (in this example /opt/tomcat). If you are using Websphere, then create and/or specify a directory that Websphere will have read/write access to.
Unix/Mac <settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <profiles> <profile> <id>tomcat5x</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <appserver.id>tomcat5x</appserver.id> <appserver.home>/opt/tomcat</appserver.home> <maven.tomcat.home>/opt/tomcat</maven.tomcat.home> <sakai.appserver.home>/opt/tomcat</sakai.appserver.home> <surefire.reportFormat>plain</surefire.reportFormat> <surefire.useFile>false</surefire.useFile> </properties> </profile> </profiles> </settings> Windows <settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <profiles> <profile> <id>tomcat5x</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <appserver.id>tomcat5x</appserver.id> <appserver.home>c:\opt\tomcat</appserver.home> <maven.tomcat.home>c:\opt\tomcat</maven.tomcat.home> <sakai.appserver.home>c:\opt\tomcat</sakai.appserver.home> <surefire.reportFormat>plain</surefire.reportFormat> <surefire.useFile>false</surefire.useFile> </properties> </profile> </profiles> </settings> Optionally, you can specify the Tomcat home to be an environment variable: <maven.tomcat.home>${env.CATALINA_HOME}</maven.tomcat.home>
Users who utilize a network proxy need to add the following to their file: ... <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>www.your.proxy.host</host> <port>80</port> <username>your_username</username> <password>your_password</password> <nonProxyHosts>localhost</nonProxyHosts> </proxy> </proxies> </settings> If you do not use a username or password for your proxy exclude <username> and <password> elements. You only need the nonProxyHosts option if you have a local maven repo that does not require the proxy to be accessed. Maven 2.0 does not support Microsoft's NTLN authentification scheme. If you connect to a proxy like ISA you will need to use a tool such as http://ntlmaps.sourceforge.net/ to proxy your traffic. Verify MavenFinally, confirm that you can start Maven, run the command mvn --version. This should start maven and cause it to report its version. At this point your environment is prepared to build and deploy the Sakai source code. mvn --version Sakai InstallationSakai Source DistributionThe Sakai Foundation and Community issues new versions of the Sakai Collaboration and Learning Environment (CLE) software on a regular basis. To obtain the latest Sakai demo, binary or source distribution visit the Sakai release site: http://source.sakaiproject.org/release/ The Sakai Community manages its source code utilizing the open-source Subversion (SVN) version control system. Sakai source code is also available from our SVN repository located at https://source.sakaiproject.org/svn/ The latest development work is located in /sakai/trunk; stable releases can be retrieved from the {/sakai/tags}} folder organized by release version. Maintenance branches may be created in the /sakai/branches folder for additional work on current or previous tagged releases. Trunk: https://source.sakaiproject.org/svn/sakai/trunk/ Tags: https://source.sakaiproject.org/svn/sakai/tags Branches: https://source.sakaiproject.org/svn/sakai/branches/ In addition, Sakai's SVN repository includes a number of projects that are not included in official Sakai releases that can be checked out and installed in the Sakai CLE. Code for these projects (known within the Sakai Community as contributed or "contrib" projects) is located at the following address: Contrib: https://source.sakaiproject.org/contrib/ Once you have installed an SVN client you can check out Sakai source code (in the case below, trunk) by issuing the following command from a terminal window: svn co https://source.sakaiproject.org/svn/sakai/trunk/ trunk 2-6-x Maintenance BranchThe latest bug fixes for a particular release can be found in our maintenance branches. Please note that certain maintenance branch fixes require database schema changes; see the Sakai Confluence Wiki 2-6-x branch summary for more information. You can download the branch by issuing the following SVN command from a terminal window: svn co https://source.sakaiproject.org/svn/sakai/branches/sakai_2-6-x/ sakai_2-6-x Post-Release 2.6 BranchesAt various times, Sakai project teams make available for the current release new functionality destined for a future release. For more information on these interim releases visit our Release Management space in our Confluence Wiki. For 2.6 post-release work see http://confluence.sakaiproject.org/confluence/display/REL/Post-2.6+Feature+Branches. Sakai ConfigurationThe sakai.properties file is a central configuration file that is typically stored in a /sakai subdirectory relative to the Tomcat home directory ($CATALINA_HOME). It is a non-XML text file containing a series of key/value pairs that is read using the load method of java.util.properties. Settings in sakai.properties govern everything from setting your institution's name to configuring your database. All settings in sakai.properties are read on startup; any changes you make subsequently will only take effect when you restart web application server. The default default.sakai.properties file is located in the config module: sakai-src/config/configuration/bundles/src/bundle/org/sakaiproject/config/bundle/default.sakai.properties A sample sample.sakai.properties file that documents many of the standard properties can also be found in config: sakai-src/config/configuration/bundles/src/bundle/org/sakaiproject/config/bundle/sample.sakai.properties If you need to override the default settings you must create your own sakai.properties file either from scratch or from a known working copy adding new key/value settings in order to customize your installation. Since any component property can in principle be overridden by a sakai.properties setting, sample sakai.properties files will show only a small fraction of all the possible settings. The default location for your local sakai.properties file is $CATALINA_HOME/sakai. This folder is not created by Maven during the build and deployment process, so you will have to create it manually or via a script. You can also store Sakai's configuration files outside of your web application server's file hierarchy. For example, in a development environment you may find yourself frequently reinstalling Tomcat and unless you create a build script to automate the Tomcat installation and configuration process avoiding having to recreate $CATALINA_HOME/sakai and sakai.properties each time has its advantages. To locate your properties file outside of your web application server environment modify the Java startup command or the JAVA_OPTS environment variable and set a system property named sakai.home. Make sure your external location is readable and writable by your web application server. -Dsakai.home=/path/to/desired/sakai/home/
Sakai Email ConfigurationEnabling Sakai to both send and receive email requires setting a number of properties in sakai.properties. For sending mail Sakai requires the address (name or IP) of an external SMTP server that will accept mail from Sakai: smtp@org.sakaiproject.email.api.EmailService=some.smtp.org To enable Sakai to receive mail you'll need to set the following properties: # dns addresses used for incoming email smtp.dns.1 = 255.255.255.1 smtp.dns.2 = 255.255.255.2 # SMTP port on which our SMTP server runs. Default is 25. #Recommend running on 8025, and using a standard mailer on 25 to forward mail to Sakai. smtp.port = 25 # flag to enable or disable our SMTP server for incoming email (true | false) smtp.enabled = true # email address used as the "from" address for any email sent by Worksite Setup tool or Site Info tool. # Recipients may not receive notifications if this address isn't valid. #setup.request=address@somedomain To disable the SMTP server for incoming email, set smtp.enabled=false in sakai.properties: smtp.enabled=false Sakai's SMTP server is Apache James. Utilizing the above configuration to run James on the standard SMTP port 25 requires admin privileges. Most admins won't permit Tomcat to run with the above permissions and would rather run a standard mailer like Postfix on port 25 and configure it to forward requests to Sakai. You may also already have a mailer service running on port 25 (Linux usually has it running by default) and so you will want to change the James port port in order to avoid a conflict. For example: smtp.port=8025 Sakai Build and DeployMaven Master POMSakai makes use of Maven's Project Object Model to provide an XML representation of basic project information covering dependency management, build targets, external repositories, issue tracking, mailing lists, reporting plugins, developer bios, etc. A top-level master pom.xml file located in the /master project acts as a parent for other pom.xml files included in other Sakai project modules. If you are building Sakai for the first time you should build the master POM first before attempting to build and deploy Sakai as whole. Issue the Maven clean and install goals from the /master project folder to build and install the master POM: cd master mvn clean install cd .. Maven Build and DeployOnce you have built the master POM, issue the following Maven goals from the sakai-src directory or from the folder containing the Sakai modules downloaded from our SVN code repository: mvn clean install sakai:deploy -Dmaven.tomcat.home=/pathto/tomcathome
When performing your first build of Sakai, Maven will run for quite a few minutes issuing fairly verbose output. Maven will download any missing dependencies into your local repository, then attempt to compile the Sakai code and, if successful, will then deploy Sakai to Tomcat in the form of *.war files in the $CATALINA_HOME/webapps directory. If during this process Maven reports that the build failed read the accompanying error message carefully to troubleshoot the issue (see the [Troubleshooting] section). You can also issue mvn clean install sakai:deploy from any sakai project module top-level folder in order to build and deploy portions of Sakai such as individual tools. Maven Goal OptionsThere are a number of other ways to build and deploy Sakai using Maven: Build and Deploy Sakai in Offline ModeIf your local repository contains all Sakai project dependencies, you can run Maven "offline" by adding the -o option: mvn -o clean install sakai:deploy Build and Deploy the Sakai "Framework"You can build and deploy the Sakai framework by adding the -Pframework option: mvn -Pframework clean install sakai:deploy Build and Deploy Sakai "Mini"You can build and deploy a minimal set of Sakai tools by adding the -Pmini option: mvn -Pmini clean install sakai:deploy Skip Unit Tests when Building and Deploying SakaiThere may be occasions when you want to build and deploy Sakai without executing the set of unit tests that accompany many of the Sakai modules. If so add -Dmaven.test.skip=true to the goals you issue: mvn -Dmaven.test.skip=true clean install sakai:deploy Starting/Stopping Sakai in TomcatAt this stage your installation of Sakai has not yet been configured to use your preferred database (it will use its own HSQLDB by default) but you should now be able to bring it up as a working web application by simply starting Tomcat, and it can be helpful at this point to know if any problems exist before you try to connect it to another database. Tomcat will take a minute or so to start up, depending on the speed of your machine, and it's a good idea to watch the Tomcat log as it comes up to catch any errors (see [Troubleshooting]). You can start Tomcat by running the appropriate start batch/shell script file from the root Tomcat directory: Windows: start-sakai.bat Once Tomcat has loaded the Sakai application (again, this can take a minute or so) point your browser to This will bring you to the Sakai gateway site from which you can create new accounts and log in to the system. If the gateway page fails to load, check the Tomcat logs (see the [Troubleshooting] section) for any errors and stack traces. If the gateway page does come up, log in with the default admin account (the username and password are both 'admin'). If you can log in without errors Sakai is alive and well. Stopping Sakai involves shutting down Tomcat by running the appropriate stop batch/shell script file from the root Tomcat directory: Windows: stop-sakai.bat Sakai LoggingOnce you have Sakai installed, configured and started, you can monitor Sakai by watching the logs. The log level for the standard Sakai source code and the demo is set to show info and warnings only. Watch for the WARN: messages. There are going to be some "normal" ones at startup, and some will likely slip by at runtime, but any warning is potentially something you might want to check out. Logging levels can be specified in sakai.properties. This augments and overrides the levels set in the default config file. Example: log.config.count=3 log.config.1 = ALL.org.sakaiproject.log.impl log.config.2 = OFF.org.sakaiproject log.config.3 = DEBUG.org.sakaiproject.db.impl This uses the established (if awkward) method of having a name.count followed by name.1, name.2 etc. to form an array of strings for the value "name". In this case, the name is "log.config". The values are of the form LEVEL.logger, and the possible levels are: OFF TRACE DEBUG INFO WARN ERROR FATAL ALL. Changing the Log ConfigurationSakai uses log4j for logging. See the official log4j documentation for more information about how to configure it if you have questions, but a few notes are collected here below. To change the logging for Sakai in the source you can use sakai-src/kernel/log-configure/src/conf/log4j.properties, and the relevant property is: log4j.logger.org.sakaiproject=INFO To turn on debug logging for all of Sakai, change that value from INFO to DEBUG. In order to turn on debug logging for just a single component of Sakai, add a line such as in the following example, which will leave most of Sakai at INFO, but generate DEBUG level messages for the SQL service: log4j.logger.org.sakaiproject=INFO log4j.logger.org.sakaiproject.component.framework.sql.BasicSqlService=DEBUG The logging controls are part of the LogConfigurationManager, implemented as a component in the util module. It can be disabled, if that's desired, with an entry in sakai.properties: enabled@org.sakaiproject.log.api.LogConfigurationManager = false For Mac and *nix systems, the most important log is found in Tomcat's logs/catalina.out. It can be instructive to watch this log as Tomcat is starting up, by using a startup command like the following: bin/startup.sh; tail -f logs/catalina.out Tomcat on Windows tends to be a little more puzzling about its logs, and it includes more of them, but its default behavior is to open catalina.out in a new window as soon as you start Tomcat. If you need more information about the logs in Windows, we'll refer you to the official Tomcat documentation.
Database InstallationSupported DatabasesSakai has been tested against and supports the following production-grade databases:
UTF-8 Character Set
If you are uncertain as to how your database is currently configured, you can check with a query. Here is a sample query for checking an Oracle instance: SQL> select value from nls_database_parameters where parameter = 'NLS_CHARACTERSET'; VALUE -------------------------------------------------------------------------------- AL32UTF8 For Mysql, the command to see what encoding your database is currently set to is "show create database sakai", assuming, of course, that your database is named "sakai". e.g.: mysql> show create database sakai; +----------+----------------------------------------------------------------+ | Database | Create Database | +----------+----------------------------------------------------------------+ | sakai | CREATE DATABASE `sakai` /*!40100 DEFAULT CHARACTER SET utf8 */ | +----------+----------------------------------------------------------------+ 1 row in set (0.00 sec) Converting a database from one character set to another is a non-trivial operation, particularly if it is a large production database. We recommend strongly that you verify this aspect of the database creation and configuration process before deploying Sakai. Database DriversChoose the appropriate MySQL or Oracle JDBC driver (or connector) for your installation. MySQL Connector/J DriverFor MySQL, download the *zip/*tar.gz archive, extract its contents and copy the mysql-connector-java-<version>-bin.jar to $CATALINA_HOME/common/lib.
Oracle OJDBC DriverFor Oracle download the ojdbc14.jar file and copy it to $CATALINA_HOME/common/lib.
Database Connection SettingsThe sakai.properties configuration file defines database technology and connection information. Appropriate sample settings for HSQLDB, Oracle and MySQL are listed below.
Whatever database you choose to use, you will need to modify at a minimum the following connection settings: url@javax.sql.BaseDataSource Set the Database Username and PasswordStart by setting your database username and password: # DATABASE CONFIGURATION - make sure to modify details to match your particular setup # The username and password. The defaults are for the out-of-the-box HSQLDB. Change to match your setup. username@javax.sql.BaseDataSource=yourDbUserName password@javax.sql.BaseDataSource=yourDbPassword Configure Database SettingsHSQLDB Sample ConfigurationHSQLDB is Sakai's default database. Remember to comment out its settings should you choose to run Sakai utilizing either MySQL or Oracle. ## HSQLDB settings - on by default
vendor@org.sakaiproject.db.api.SqlService=hsqldb
driverClassName@javax.sql.BaseDataSource=org.hsqldb.jdbcDriver
hibernate.dialect=org.hibernate.dialect.HSQLDialect
validationQuery@javax.sql.BaseDataSource=select 1 from INFORMATION_SCHEMA.SYSTEM_USERS
# two hsqldb storage options: first for in-memory (no persistence between runs), second for disk based
#url@javax.sql.BaseDataSource=jdbc:hsqldb:mem:sakai
url@javax.sql.BaseDataSource=jdbc:hsqldb:file:${sakai.home}db/sakai.db
MySQL Sample ConfigurationLocate the MySQL configuration block, uncomment the settings and save your changes. Make sure you modify the data source, username and password settings to match your local environment. Do not forget to comment out the HSQLDB and Oracle settings. # MySQL settings - make sure to alter as appropriate vendor@org.sakaiproject.db.api.SqlService=mysql driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect url@javax.sql.BaseDataSource=jdbc:mysql://127.0.0.1:3306/sakai?useUnicode=true&characterEncoding=UTF-8 validationQuery@javax.sql.BaseDataSource=select 1 from DUAL defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED # To get accurate mysql query throughput statistics (for example for graphing) from the mysql command # show status like 'Com_select' # this alternate validation query should be used so as not to increment the query counter unnecessarily # when validating the connection: #validationQuery@javax.sql.BaseDataSource=show variables like 'version' Oracle Sample ConfigurationLocate the Oracle configuration block, uncomment the settings and save your changes. Make sure you modify the data source, username and password settings to match your local environment. Do not forget to comment out the HSQLDB and MySQL settings. ## Oracle settings - make sure to alter as appropriate vendor@org.sakaiproject.db.api.SqlService=oracle driverClassName@javax.sql.BaseDataSource=oracle.jdbc.driver.OracleDriver hibernate.dialect=org.hibernate.dialect.Oracle9Dialect url@javax.sql.BaseDataSource=jdbc:oracle:thin:@your.oracle.dns:1521:SID validationQuery@javax.sql.BaseDataSource=select 1 from DUAL defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED
# For improved Oracle performance (from the University of Michigan) validationQuery@javax.sql.BaseDataSource= defaultTransactionIsolationString@javax.sql.BaseDataSource= testOnBorrow@javax.sql.BaseDataSource=false The auto.ddl Setting
# establish auto.ddl - on by default auto.ddl=true #auto.ddl=false
Database MigrationOverviewA database conversion is typically required between Sakai versions. Database conversion scripts - in distinct versions for MySQL and Oracle, respectively - are found in the reference/docs/conversion folder of the release or in our SVN repository: In the same directory you'll also find conversion scripts for earlier Sakai versions. Migration from an earlier version will require the successive application of all intermediate scripts (see the following table). You cannot, for example, move from 2.2.1 to 2.4.0 by applying a single script. The were no database schema changes between 2.4.0 and 2.4.1, so you can migrate to the 2.5.0 schema from either version using the 2.4.0 scripts.
Other Conversion2.5 also includes data and schema conversion outside the standard scripts for Assignments and Content Hosting to address data integrity for assignments and performance enhancements in both tools. Below is a quick summary and overview of the process for each tool. AssignmentsThe assignment service has permitted the creation of duplicate submission objects (i.e. 2 or more submissions for the same student and assignment). While the UI should prevent this from happening, at various stages in the evolution of the Assignments code, bugs, race conditions or other failures have led to duplicate objects being created. This conversion seeks to reconcile those duplicates and add database constraints to prevent this is the future. In summary, the conversion script is necessary to
The conversion script does the following to the existing ASSIGNMENT_SUBMISSION table in Sakai database:
There is a readme file with detailed instructions on this process at https://source.sakaiproject.org/svn/assignment/tags/sakai_2-5-0. In addition, there is further information in the related JIRA SAK-11821.
Content HostingMoving from 2.4 to 2.5 requires adding several columns to the database tables used by the Content Hosting Service (the service used by the Resources tool, Dropbox, filepicker and WebDAV). The conversion scripts contain DDL statements to accomplish those changes. You need to run these conversions scripts (or perform the equivalent operations manually) and then convert your existing Resources via one of the methods outlined below, before you will gain the performance improvements Sakai 2.5 offers. The new columns added to the database tables support a switch from XML serialization to "binary-entity" serialization, and enable Resources to perform faster and use less memory. One of the key areas this impacts is improving the performance of quota calculations. There are two methods for converting existing Resources, with the first being the recommended option, as it enables all performance improvements when completed:
Based on the state of the data in the Content Hosting Service tables, it will start up in one of two modes:
DiscussionThe Discussion tool was retired and removed for Sakai 2.5. (Upgrade/Migration options...) Troubleshooting IssuesTroubleshooting IssuesGetting HelpBelow are a number of common issues encountered while building and starting up Sakai but you may also benefit from the expert advice and assistance available within the Sakai developer community. The quickest way to get your questions answered is to join the Sakai Development Work Group (otherwise known as sakai-dev) and send an email to the list. To join the sakai-dev list go to http://collab.sakaiproject.org, create a new account, log in to Collab, select the My Workspace tab, and then use the Membership tool to join the group named DG: Development. You can then begin to send emails to (and receive them from) sakai-dev@collab.sakaiproject.org. To later unsubscribe, you can simply use the same Membership tool to unjoin the site. Build IssuesJAR download failuresA first build of Maven on a fresh installation may warn of numerous jar download failures if you include the clean phase. This is a nuisance, but not otherwise a problem. Even when doing a clean maven tries to download all dependencies, including those Sakai jars that may not be built until the later build phase. Once they are built and placed into the repository, maven is perfectly happy for the next "clean build" cycle. The upshot is that you may see these errors for your first build, but you shouldn't see them for subsequent builds. It also means that you're better off not including the clean phase during your first build of a new version of the code. If this does not account for the download failures you're seeing, then you may want to double-check your maven.remote.repo setting. See the Maven Configuration section, and follow it precisely. Out of Memory errorsYou may find that your machine runs out of memory while it is building Sakai. As it turns out, maven does not read JAVA_OPTS when it starts up, and so if your build output complains of "Out of Memory" errors you'll need to set an additional environment variable, namely, MAVEN_OPTS. The value in the sample Unix command below should be more than enough: export MAVEN_OPTS="-Xmx384m -XX:PermSize=48m" Uninformative failure messagesIf you need more detailed output to track down a build error, maven can be run in debug mode by adding the -x argument, e.g. mvn -x. |