Skip to end of metadata
Go to start of metadata

As of Archiva 1.1, the bundled distribution is simply Jetty 6.1 and a web application, so this document is redundant

Running Archiva on Jetty

There are multiple methods:

Method: Jetty Configuration File

These instructions relate to Jetty 6.0.2 and Archiva trunk r493027.

  • wget http://dist.codehaus.org/jetty/jetty-6.0.2.zip
  • unzip jetty-6.0.2.zip
  • cd jetty-6.0.2
  • mkdir archiva
  • mkdir derby-system-home
  • mkdir appserver-base
  • mkdir appserver-base/logs
  • ln -s ~/.m2/repository/org/apache/derby/derby/10.1.3.1/derby-10.1.3.1.jar lib/
  • ln -s path/to/your/archiva-webapp-1.0-SNAPSHOT.war archiva/
  • Create file archiva/archiva-override-web.xml with content as below
  • Create file archiva/archiva-jetty6.0-config.xml with content as below
  • java -jar start.jar etc/jetty.xml archiva/archiva-jetty6.0-config.xml

archiva-override-web.xml

<?xml version="1.0"?>
<web-app
  xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  version="2.5">

  <resource-ref>
    <res-ref-name>jdbc/users</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

  <resource-ref>
    <res-ref-name>jdbc/shutdown</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

</web-app>

archiva-jetty6.0-config.xml

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">

<Configure id="Server" class="org.mortbay.jetty.Server">

  <Call class="java.lang.System" name="setProperty">
    <Arg>derby.system.home</Arg>
    <Arg><SystemProperty name="jetty.home"/>/derby-system-home</Arg>
  </Call>

  <Call class="java.lang.System" name="setProperty">
    <Arg>appserver.base</Arg>
    <Arg><SystemProperty name="jetty.home"/>/appserver-base</Arg>
  </Call>

  <Array id="plusConfig" type="java.lang.String">
    <Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
    <Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
    <Item>org.mortbay.jetty.plus.webapp.Configuration</Item>
    <Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
    <Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
  </Array>

  <New class="org.mortbay.jetty.plus.naming.Resource">
    <Arg>jdbc/users</Arg>
    <Arg>
      <New class="org.apache.derby.jdbc.EmbeddedDataSource">
        <Set name="DatabaseName">archiva-jetty-database</Set>
        <Set name="user">sa</Set>
        <Set name="createDatabase">create</Set>
      </New>
    </Arg>
  </New>

  <New class="org.mortbay.jetty.plus.naming.Resource">
    <Arg>jdbc/shutdown</Arg>
    <Arg>
      <New class="org.apache.derby.jdbc.EmbeddedDataSource">
        <Set name="DatabaseName">archiva-jetty-database</Set>
        <Set name="user">sa</Set>
        <Set name="shutdownDatabase">shutdown</Set>
      </New>
    </Arg>
  </New>

  <New class="org.mortbay.jetty.webapp.WebAppContext">
    <Arg><Ref id="contexts"/></Arg>
    <Arg>archiva/archiva-webapp-1.0-SNAPSHOT.war</Arg>
    <Arg>/archiva</Arg>
    <Set name="overrideDescriptor">archiva/archiva-override-web.xml</Set>
    <Set name="configurationClasses"><Ref id="plusConfig"/></Set>
  </New>

</Configure>

Method: Auto-deploy after inserting an additional file into the webapp.

  1. downloaded jetty 6.0.2
  2. installed default jetty 6.0.2
  3. removed all content under webapps/*
  4. unpacked archiva war file into webapps/archiva/
  5. copied jetty-env.xml into webapps/archiva/WEB-INF/jetty-env.xml
  6. modified default port in jetty.xml
  7. Started up with following command.

~/java/jetty-6.0.2
$ java -Xmx256m -jar start.jar etc/jetty.xml etc/jetty-plus.xml

NOTE: The jetty-plus configuration is REQUIRED to get jndi binding to work.

  • No labels