Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Continuum on Tomcat

Continuum 1.1-SNAPSHOT on Tomcat 5.x and 6.x

These instructions explain how to deploy the (unreleased) Continuum 1.1-SNAPSHOT web application in an existing installation of Tomcat 5.x and Tomcat 6.x.

1. Build Continuum or obtain a pre-built snapshot.

2. Locate the continuum-webapp-1.1-SNAPSHOT.war file.
(If you built Continuum, it will be in continuum-webapp/target.)
(If you have downloaded Continuum, it will be in continuum-1.1-XXX/apps/continuum-plexus-application-1.1-XXX.jar/lib/.)

3. Add a context configuration file for the web application:

For Tomcat 5.0.x
    $TOMCAT_HOME/conf/Catalina/localhost/continuum.xml

No Format
<?xml version="1.0" encoding="UTF-8"?>
 <Context path="/continuum"
          docBase="/path/to/continuum-webapp-1.1-SNAPSHOT.war">

  <Resource name="jdbc/users" auth="Container" type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/users">
     <parameter><name>driverClassName</name><value>org.apache.derby.jdbc.EmbeddedDriver</value></parameter>
     <parameter><name>url</name><value>jdbc:derby:/path/to/data/database/users;create=true</value></parameter>
     <parameter><name>username</name><value>sa</value></parameter>
     <parameter><name>password</name><value></value></parameter>
     <parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
 </ResourceParams>

  <Resource name="jdbc/continuum" auth="Container" type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/continuum">
     <parameter><name>driverClassName</name><value>org.apache.derby.jdbc.EmbeddedDriver</value></parameter>
     <parameter><name>url</name><value>jdbc:derby:/path/to/data/database/continuum;create=true</value></parameter>
     <parameter><name>username</name><value>sa</value></parameter>
     <parameter><name>password</name><value></value></parameter>
     <parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
 </ResourceParams>

  <Resource name="mail/Session" auth="Container" type="javax.mail.Session"/>
  <ResourceParams name="mail/Session">
     <parameter><name>mail.smtp.host</name><value>smtp.coltfrance.com</value>
     </parameter>
 </ResourceParams>
 </Context>


For Tomcat 5.5.x
    $TOMCAT_HOME/conf/Catalina/localhost/continuum.xml

For Tomcat 6.0.x
     $TOMCAT_HOME/webapps/continuum-webapp-1.1-SNAPSHOT/META-INF/context.xml

No Format
<?xml version="1.0" encoding="UTF-8"?>
 <Context path="/continuum"
          docBase="/path/to/continuum-webapp-1.1-SNAPSHOT.war">

 <Resource name="jdbc/users" auth="Container" type="javax.sql.DataSource"
           username="sa"
           password=""
           driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
           url="jdbc:derby:/path/to/data/database/users;create=true" />

 <Resource name="jdbc/continuum" auth="Container" type="javax.sql.DataSource"
           username="sa"
           password=""
           driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
           url="jdbc:derby:/path/to/data/database/continuum;create=true" />

 <Resource name="mail/Session" auth="Container"
            type="javax.mail.Session"
            mail.smtp.host="localhost"/>
 </Context>


WARNING: The Tomcat 5.5.20 release is missing MailSessionFactory and a few other classes. JNDI mail sessions will not work. Either use Tomcat 5.5.17 or see Bug 40668 for a workaround.

Tomcat JNDI Resources HOWTO

4. Place the following jars in $TOMCAT_HOME/common/lib(Tomcat 5.x) $TOMCAT_HOME/lib(Tomcat 6.x):
(click the links to download each jar from the central Maven repository)

5. Start Tomcat

6. Access the application at http://localhost:8080/continuum

Optional Configuration

  • Override the "To:" address for all mail sent from Continuum. Modify the <code><to-override></code> element in <code>$TOMCAT_HOME/webapps/continuum/WEB-INF/classes/META-INF/plexus/application.xml</code> and provide an alternate email address.
    No Format
    <plexus>
        ...
        <component>
          <role>org.codehaus.plexus.notification.RecipientSource</role>
          <implementation>org.apache.maven.continuum.notification.ContinuumRecipientSource</implementation>
          <configuration>
            <!--
            Setting this propery will make Continuum send all emails to
            this address instead the address specified in the project
            configuration
            -->
            <to-override>myself@example.com</to-override>
          </configuration>
        </component>
    ...
    </plexus>
    





Questions

An ${appserver.base} directory is being created in $TOMCAT_HOME/bin

Derby Database File Locations

Instead of absolute paths, you can use a relative location for the database in the connection strings: jdbc:derby:users;create=true and jdbc:derby:continuum;create=true

To control where Derby creates the databases, "You define the system directory when Derby starts up by specifying a Java system property called derby.system.home." as described here : derby dev guide

Updating a Tomcat Deployment

In preparation for deploying a new snapshot of Continuum 1.1

Stop Tomcat, and delete the following files and directories:

  • $TOMCAT_HOME/webapps/continuum
  • $TOMCAT_HOME/work/Catalina/localhost/continuum

There may also be a $TOMCAT_HOME/bin/${appserver.base} directory. (This should not be happening.)

Notes

Thijs Schnitger says:

I had to add 2 JAVA_OPTS to my Tomcat startup script  to get it to work:
-Dplexus.system.path=$PATH to get Continuum to find the mvn and ant executables,
-Dappserver.base=$CATALINA_HOME to get the logfile in the right dir and remove the  ${appserver.base} dirs popping up in $CATALINA_HOME and the appBase of my Tomcat host.

My experiences with Continuum 1.2.3 on Tomcat 5.5.27

Jakub Holý says:

Deploying Continuum 1.2.3 to Tomcat 5.5.27 wasn't so straight-forward as just following the 5.5.x instructions therefore I'd like to share with you the knowledge how I got it working.

Environment: Java(TM) SE Runtime Environment (build 1.6.0_14-b08), OS Linux

1. Prepare Tomcat as per the 5.5.x instructions

Follow the standard instructions to setup the things you need.

  1. Use at least Java JDK 1.5.0_11 to run Tomcat w/Continuum.
  2. A defined xml section to define the JNDI resources.
  3. The JavaMail / Activation JAR files.
  4. The Apache Derby JAR files.
  5. Configure ${appserver.base} java property.

Install Continuum

  1. Download apache-continuum-1.2.3.war.
  2. Extract the content of the .war archive to $CATALINA_HOME/webapps/continuum/ (which should thus contain WEB-INF/, index.jsp etc.).

2. Modify $CATALINA_HOME/conf/Catalina/localhost/continuum.xml

If you followed also the Tomcat 5.5.x Specifics instruction, you have created the file  $CATALINA_HOME/conf/Catalina/localhost/continuum.xml. We will need to do some modifications to the file to avoid the following exception:

No Format
 
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /continuum does not exist or is not a readable directory
        at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:141)

Namely we will remove the attribute docBase and better also the unnecessary path since Tomcat can derive them from this file's name, partly thanks to the fact, that we have unpacked the .war into a folder of the same name as the desired context root and this file's name (continuum). Thus we will get

Code Block
xml
xml
titlecontinuum.xml
 <Context>

  <Resource name="jdbc/users"
            auth="Container"
            type="javax.sql.DataSource"
            username="sa"
            password=""
            driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
            url="jdbc:derby:database/users;create=true" />

  <Resource name="jdbc/continuum"
            auth="Container"
            type="javax.sql.DataSource"
            username="sa"
            password=""
            driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
            url="jdbc:derby:database/continuum;create=true" />

<!-- see http://mail-archives.apache.org/mod_mbox/tomcat-users/200801.mbox/%3C477B7EC1.10301@solcon.nl%3E -->
  <Resource name="mail/Session"
            auth="Container"
            type="javax.mail.Session"
            mail.smtp.host="localhost" mail.smtp.port="10025" mail.smtp.auth="true" mail.smtp.user="jh@localhost" password="secret"/>
</Context>

I've a bit more complicated setting of the SMTP server, maybe its basic setup (only setting  mail.smtp.host) is enough for you.

3. Solve a Derby issue

During Continuum startup (see logs/continuum.log) there were some exception due  to the schema "SA" not existing, this is a known issue and can be safely ignored. However after that the application failed to start due to the following exception:

No Format
ERROR JPOX.RDBMS.Schema  - Failed initialising database. Please check that your database JDBC driver is accessible, and the database URL and username/password are correct. Exception : Cannot create PoolableConnectionFactory (Failed to start database 'database/continuum', see the next exception for details.)
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Failed to start database 'database/continuum', see the next exception for details.)

Unfortunately there was no "next exception" with any details. At the end I've found out that the problem is due to the database being locked and not unlocked. You can reproduce the error by trying to connect to the database with some tool like DBViewr for Eclipse or SQuirreL SQL, the database is located (after the first startup that created it) under $CATALINA_HOME/database/continuum.

Solution: Stop Tomcat and delete the likely two *.lck files from  $CATALINA_HOME/database/continuum/.

Now you should be able to start Tomcat with Continuum and access it at  http://localhost:8080/continuum without problems.