Archiva on Geronimo-2.0.2 with MySQL backend

Prerequisites

  • Installed geronimo application server http://geronimo.apache.org
  • Installed MySQL server with DBA account http://www.mysql.com
  • Installed JDK 1.5+
  • MySQL Driver v5.1.5 installed in the Geronimo repository
  • commons-lang v2.2 installed in the Geronimo repository
  • common-collections v3.2 installed in the Geronimo repository

 MySQL

Create database

Login on the mysql server with the DBA account. ( mysql -h server - p )

Create a database

create database archiva;

 Create user with sufficient access rights

GRANT SELECT,INSERT,UPDATE,DELETE,DROP,CREATE ON archiva.* TO archiva@localhost IDENTIFIED BY 'archiva';

 Geronimo configuration

Start up

On my machine there is sometimes an out of memory error. To prevent this error there is an option parameter to the SUN JVM. Here is the description on a debian system

export JAVA_OPTS='-XX:MaxPermSize=128m'

Start the server 

/path/to/geronimo/bin/geronimo.sh start

Database pool

Login with an administrator account on geronimo
default : http://localhost:8080/console/   user=system,pass=manager

Use the menu on the left:
Database Pools -> Using the Geronimo database pool wizard

Step 1 of the wizard

Name of database pool : archiva

Database Type : MySQL 

Step 2 of the wizard

Driver Jar : mysql/mysql-connector/5.1.5/jar 

Port Number : 3306

URL : jdbc:mysql://localhost:3306/archiva

User Name : archiva

Server Name : localhost

Database Name : archiva

Password : archiva 

Confirm Password : archiva

Pool min size : 5

Pool max size : 15

Deploy Archiva

Login with an administrator account on geronimo
default : http://localhost:8080/console/   user=system,pass=manager

commons-collections v3.2 and commons-lang v2.2 must be in the Geronimo repository. You can check this in the "Common lib". If those libraries are not present the must be uploaded. There a a possibility to upload these libraries in "Common lib".

Use for commons-collections the groupId = "commons-collections" and the artifactId = "commons-collections"
Use for commons-lang the groupId = "commons-lang" and the artifactId = "commons-lang"

Deployment with the console

Download archiva http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-archiva-1.0.war 

Use "Deploy New" from the menu on the left in the console.

Archive : Use the downloadde apache-archiva-1.0.war  

Plan : Use the deployment plan attached to this page

Commandline Deployment

Download the deployment plan attached to this page 

Go to the bin directory

On linux :

cd /path/togeronimo/bin

sh deploy.sh deploy /path/to/apache-archiva-1.0.war /path/to/geronimo-web.xml

Deployment plan

Geronimo 2.0.2 Deployment plan for Archiva

  • No labels

3 Comments

  1. I tried this out with Archiva 1.0.1, and here were some modifications to the instructions specified here I had to do in order to be able to deploy it on Geronimo (tomcat) 2.0.2:

    1. Update the version of archiva to 1.0.1 in the deployment plan
    2. In MySql, also grant the INDEX and ALTER command to user archiva@localhost

      GRANT INDEX,ALTER ON archiva.* TO archiva@localhost IDENTIFIED BY 'archiva';
      
    3. Modify the war file. (This is necessary because Geronimo 2.0.2 has a problem with tld loading causing an error while deploying Archiva. I think this bug was fixed in Geronimo 2.1.)
      • Rename apache-archiva-1.0.1.war to apache-archiva-1.0.1.zip
      • Unpack apache-archiva-1.0.1.zip
      • Modify the WEB-INF/classes/META-INF/taglib.tld file – remove the whitespace in the <short-name> value. So 'Archiva Taglib' becomes 'ArchivaTaglib'
      • Now, go to WEB-INF/lib and rename webwork-2.2.6.jar to webwork-2.2.6.zip
      • Unpack webwork-2.2.6.zip
      • Modify the unpacked META-INF/taglib.tld – remove the whitespace in the <short-name> value. So 'Webwork Taglib' now becomes 'WebworkTaglib'
      • Now repackage the unpacked webwork-2.2.6 to webwork-2.2.6.zip. Then rename the created file to webwork-2.2.6-jar. Copy the repackaged webwork-2.2.6.jar to the previously unpacked archiva war file (in directory WEB-INF/lib/)
      • Repackage the unpacked apache-archiva-1.0.1 to apache-archiva-1.0.1.zip. Rename the zip file to apache-archiva-1.0.1.war. Deploy this war file to Geronimo including the deployment plan.

    Btw, my environment is:

    • ubuntu linux 7.04
    • jdk 1.5.0_11
    • geronimo-tomcat6-jee5-2.0.2
  2. There's also a problem with Jdom in Geronimo and Archiva, so you need to hide the jaxen jar by configuring this in the geronimo-web.xml:

    <sys:hidden-classes>
      <sys:filter>org.jaxen.</sys:filter>
      ...
    </sys:hidden-classes>
    

    For more details, see http://jira.codehaus.org/browse/MRM-727

  3. After a couple of posts on the Archiva-Users forum I got Archiva 1.2 installed on Geronimo 2.1.4:

    1. Updated the deployment plan with the latest versions, the one that got me was the javamail:

    <?xml version="1.0" encoding="UTF-8"?>
    <web:web-app
    xmlns:gernaming="http://geronimo.apache.org/xml/ns/naming-1.2"
    xmlns:geronimo="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
    xmlns:persistence="http://java.sun.com/xml/ns/persistence"
    xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
    xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1 ">
    <sys:environment>
    <sys:moduleId>
    <sys:groupId>org.apache.maven.archiva</sys:groupId>
    <sys:artifactId>archiva</sys:artifactId>
    <sys:version>1.2</sys:version>
    </sys:moduleId>
    <sys:dependencies>
    <sys:dependency>
    <sys:groupId>console.dbpool</sys:groupId>
    <sys:artifactId>archiva</sys:artifactId>
    </sys:dependency>
    <sys:dependency>
    <sys:groupId>org.apache.geronimo.configs</sys:groupId>
    <sys:artifactId>javamail</sys:artifactId>
    <sys:version>2.1.4</sys:version>
    <sys:type>car</sys:type>
    </sys:dependency>
    <sys:dependency>
    <sys:groupId>commons-lang</sys:groupId>
    <sys:artifactId>commons-lang</sys:artifactId>
    <sys:version>2.3</sys:version>
    <sys:type>jar</sys:type>
    </sys:dependency>
    <sys:dependency>
    <sys:groupId>commons-collections</sys:groupId>
    <sys:artifactId>commons-collections</sys:artifactId>
    <sys:version>3.2</sys:version>
    <sys:type>jar</sys:type>
    </sys:dependency>
    </sys:dependencies>
    <sys:hidden-classes>
    <sys:filter>org.apache.commons.lang.</sys:filter>
    <sys:filter>org.apache.commons.collections.</sys:filter>
    </sys:hidden-classes>
    </sys:environment>

    <web:context-root>/archiva</web:context-root>
    <gernaming:resource-ref>
    <gernaming:ref-name>jdbc/archiva</gernaming:ref-name>
    <gernaming:resource-link>archiva</gernaming:resource-link>
    </gernaming:resource-ref>
    <gernaming:resource-ref>
    <gernaming:ref-name>jdbc/users</gernaming:ref-name>
    <gernaming:resource-link>archiva</gernaming:resource-link>
    </gernaming:resource-ref>
    <gernaming:resource-ref>
    <gernaming:ref-name>mail/Session</gernaming:ref-name>
    <gernaming:resource-link>mail/MailSession</gernaming:resource-link>
    </gernaming:resource-ref>
    </web:web-app>

    2. Based on the Tomcat install instructions I set the GERONIMO_OPTS and the JAVA_OPTS.

    set JAVA_OPTS=-XX:PermSize=256m -XX:MaxPermSize=256m -Xms512m -Xmx1024m
    set GERONIMO_OPTS=-Dappserver.home="%GERONIMO_HOME%" -Dappserver.base="%GERONIMO_HOME%\archiva"

    3. From the comment above, item #2 it still applies.

    GRANT INDEX,ALTER ON archiva.* TO archiva@localhost IDENTIFIED BY 'archiva';

    4. I had a big glassfish appserver-rt.jar so I had to update the struts.properties file in the war.

    struts.multipart.maxSize=20971520

    After that all was well with the deploy and start of the application, the only difference I have found between the Tomcat and Geronimo install is the archiva logs. With the Tomcat install the archiva logs are going to the archiva\logs folder, but with Geronimo the logging is sent to the Geronimo var\log folder.