Archiva can be deployed as a web application into any Java EE application server. This document will show an example of doing so with Tomcat 5.5 and Tomcat 6.0.x.
Note: When you first start Archiva, you will see an Exception that schema SA does not exist - however it doesn't cause a problem. If you use a username other than 'sa', such as 'archiva', then you seem to get the same error but Tomcat fails to start the context and you have to shutdown and restart again.
<?xml version="1.0" encoding="UTF-8"?> <Context path="/archiva" docBase="${catalina.home}/archiva/apache-archiva-1.1.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/database/users;create=true" /> <Resource name="jdbc/archiva" auth="Container" type="javax.sql.DataSource" username="sa" password="" driverClassName="org.apache.derby.jdbc.EmbeddedDriver" url="jdbc:derby:/path/to/database/archiva;create=true" /> <Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="localhost"/> </Context>
Note: Tomcat 5.5.20 and 5.5.23 are missing MailSessionFactory and a few other classes. JNDI mail sessions will not work. Use Tomcat 5.5.25 instead, or see Bug 40668 for a workaround.
export CATALINA_OPTS="-Dappserver.home=$CATALINA_HOME -Dappserver.base=$CATALINA_HOME" (for UNIX) OR set CATALINA_OPTS="-Dappserver.home=%CATALINA_HOME% -Dappserver.base=%CATALINA_HOME%" (for Windows)
# for Windows: appserver.base=%CATALINA_HOME% appserver.base=%CATALINA_BASE% # or, for UNIX: appserver.base=$CATALINA_HOME appserver.home=$CATALINA_BASE
-Dappserver.base=%CATALINA_HOME% -Dappserver.home=%CATALINA_HOME%
For more information, see Archiva on Tomcat in the wiki.
Archiva is configured using the ~/.m2/archiva.xml configuration file by default when using a Java EE application server.
To upgrade the Archiva web application, simply replace the web application with an alternative. Since the database and configuration files are stored externally to the application, no further maintainance is needed.
For general information about upgrading Archiva, see the relevant section in the Installing standalone guide.
Once Archiva is running, it is configured in the same way as the standalone instance. See the quick start guide for more information.
There are cases when the Tomcat logs only shows the following error during startup:
... Aug 17, 2009 11:04:02 AM org.apache.catalina.core.StandardContext start SEVERE: Error listenerStart Aug 17, 2009 11:04:02 AM org.apache.catalina.core.StandardContext start SEVERE: Context [/archiva] startup failed due to previous errors Aug 17, 2009 11:04:04 AM org.apache.coyote.http11.Http11BaseProtocol start ...
One of the common causes for this listenerStart Error is a failure during Spring's initialization. One way to diagnose or confirm the exact cause of the error is by adding the following configuration to the unpacked Archiva webapp's WEB-INF/classes/log4j.xml:
<appender name="console" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/> </layout> </appender> <logger name="org.springframework.web"> <level value="debug"/> <appender-ref ref="console"/> </logger>
The above configuration directs Spring's output logs to the Tomcat console and be recorded in Tomcat's log files.
One of the least decipherable errors you can get from Tomcat is a 404 when the deployment fails. In <tomcat home>/logs/catalina.out you will only find that it fails, but not why. Also Archiva's logs will not tell you.
The log messages and stack traces in case of a 404 can be found in <tomcat home>/logs/localhost.<date>.