Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

6. deploy the new WAR and Archiva should work.

Archiva 1.1.x on JBoss 4.2.x with an external datasource (tested with 1.1.3 on 4.2.2.GA)

While it is possible to use Archiva with the packaged Derby database it is often preferable to use an existing external RDBMS because it will integrate Archiva better into existing backup and maintenance processes. For the same reason it may be preferable to use your existing JBoss installation instead of Jetty supplied with the standalone installation. This tutorial will show you how this can be done.

  1. Connect to the database and create a user archiva and two schemas (or databases). In this example they are called archiva and archiva_users. Make sure the archiva user has appropriate rights to create tables on those schemas.
  2. Copy the JDBC driver (the jar file) for your databaseto <JBOSS_HOME>/server/default/lib. <JBOSS_HOME> is the directory where your JBoss is installed. (I assume throughout this text you are running the default instance because otherwise you would probably not bother to read this tutorial.)
  3. Create a file called archiva-ds.xml in <JBOSS_HOME>/server/default/deploy:
    No Format
    <?xml version="1.0" encoding="UTF-8"?>
    <datasources>
      <local-tx-datasource>
        <jndi-name>/jdbc/archiva</jndi-name>
        <connection-url>jdbc:postgresql://database.mycompany.com/archiva</connection-url>
        <driver-class>org.postgresql.Driver</driver-class>
        <user-name>archiva</user-name>
        <password>archiva</password>
        <min-pool-size>5</min-pool-size>
        <max-pool-size>20</max-pool-size>
        <idle-timeout-minutes>0</idle-timeout-minutes>
        <track-statements/>
      </local-tx-datasource>
    
      <local-tx-datasource>
        <jndi-name>/jdbc/archiva_users</jndi-name>
        <connection-url>jdbc:postgresql://database.mycompany.com/archiva_users</connection-url>
        <driver-class>org.postgresql.Driver</driver-class>
        <user-name>archiva</user-name>
        <password>archiva</password>
        <min-pool-size>5</min-pool-size>
        <max-pool-size>20</max-pool-size>
        <idle-timeout-minutes>0</idle-timeout-minutes>
        <track-statements/>
      </local-tx-datasource>
    </datasources>
    
    This example uses postgresql. If you use a different database you must alter the connection string and the driver class. For more infomation on setting up datasources take a look at the JBoss Wiki.
  4. To enable email you must verify that the mail settings in <JBOSS_HOME>/server/default/deploy-mail-service.xml are correct. Again the JBoss Wiki may be helpful.
  5. Create a directory <JBOSS_HOME>/server/default/deploy/archiva.war
  6. Download the Archiva war distribution and unzip the contents of that file to the archive created above.
  7. By default archiva uses its own logging mechanism. It is preferable to redirect logging output to the application server. To do so delete the following files:
    • <JBOSS_HOME>/server/default/deploy/archiva.war/WEB-INF/lib/commons-logging-1.0.4.jar (causes the Spring ContextClassLoader to throw an ExceptionInInstantiation)
    • <JBOSS_HOME>/server/default/deploy/archiva.war/WEB-INF/lib/log4j-1.2.8.jar (causes a logger ClassCastException)
    • <JBOSS_HOME>/server/default/deploy/archiva.war/WEB-INF/stax-api-1.0.1.jar (causes a ClassCastException. This jar conflicts with JBossWS)
    • <JBOSS_HOME>/server/default/deploy/archiva.war/WEB-INF/classes/log4j.xml (Removing log4j.xml will redirect all logging output to the container)
  1. To tell Archiva about the datasources you created in step 3 you need to create an application server specific deployment descriptor. Simply create a file <JBOSS_HOME>/server/default/deploy/archiva.war/WEB-INF/jboss-web.xml with the following content:
    No Format
    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-web>
     <resource-ref>
       <res-ref-name>jdbc/users</res-ref-name>
       <jndi-name>java:/jdbc/archiva_users</jndi-name>
     </resource-ref>
    <resource-ref>
       <res-ref-name>jdbc/archiva</res-ref-name>
       <jndi-name>java:/jdbc/archiva</jndi-name>
     </resource-ref>
     <resource-ref>
       <res-ref-name>mail/Session</res-ref-name>
       <jndi-name>java:/Mail</jndi-name>
     </resource-ref>
    </jboss-web>
    
  2. <JBOSS_HOME>/server/default/deploy/archiva.war/WEB-INF/classes/application.properties add the following line:
    No Format
    
    appserver.base=
    
    This will make it unnecessary to set the system property appserver.base.
  3. Make sure ~/.m2 (the subdirectory .m2 in the home directory of the user that is running JBoss) is writable.
  4. Restart the application server (or touch <JBOSS_HOME>/server/default/deploy/archiva.war/WEB-INF/web.xml to redeploy.)
  5. Goto http://your.application.server:8080/archiva/.

Archiva 1.1 on JBoss 4.2.2 GA

...

  1. .

...