Apache Archiva is an extensible repository management software that helps taking care of your own personal or enterprise-wide build artifact repository. It is the perfect companion for build tools such as Maven, Continuum, and ANT.

Archiva offers several capabilities, amongst which remote repository proxying, security access management, build artifact storage, delivery, browsing, indexing and usage reporting, extensible scanning functionality… and many more!

This guide will show you, how to run Apache Archiva on JBoss AS 4.2.3.GA, with an external datasource using Apache Derby as the database.


Datasource configuration 

Archiva uses an external database for two purposes:

  • Storing artifact information
  • As a default user store for security

archiva-ds.xml file:

<?xml version="1.0" encoding="UTF-8"?>
    <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
    <!-- Datasources are not available outside the virtual machine -->
    <!-- for in-process persistent db, saved when jboss stops. The org.jboss.jdbc.DerbyDatabase mbean is necessary for properly db shutdown -->
    <!-- The driver class -->
    <!-- The login and password -->
    <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
    <!-- The maximum connections in a pool/sub-pool -->
    <!-- The time before an unused connection is destroyed -->
    <!-- Whether to check all statements are closed when the connection is returned to the pool, this is a debugging feature that should be turned off in production -->



Note: Archiva uses JNDI data sources to locate the databases to use:

  • jdbc/archiva – the repository database
  • jdbc/users – the user store

Creating the deployment descriptor

To tell Archiva about the datasources you created in step above you need to create an application server specific deployment descriptor. Simply create the jboss-web.xml file with the following content:

<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
<class-loading java2ClassLoadingCompliance="false">

Preparing the JBoss Server

  • Add \db-derby-\lib\derby.jar file to $JBOSS_HOME/server/<instance_name>/lib folder.
  • Add archiva-ds.xml file to $JBOSS_HOME/server/<instance_name>/deploy folder.
  • Add this two parameters to the JBoss service inicialization:
    -Dappserver.home=”$JBOSS_HOME” -Dappserver.base=”$JBOSS_HOME”

Note: In the step above, replace the $JBOSS_HOME, with the full path of your operational system, where you installed the JBossAS.

Preparing the Archiva application

  • Rename the war file to ‘archiva.war’, removing the version suffix.
  • Remove the specific log4j.xml configuration file existing under \archiva.war\WEB-INF\classes\log4j.xml. This way the container logging configuration will be used.
  • Remove \archiva.war\WEB-INF\lib\stax-api-1.0.1.jar. This jar causes a ClassCastException (conflicts with JBossWS).
  • Add \spring-framework-2.5.6.SEC01.zip\dist\modules\spring-orm.jar to \archiva.war\WEB-INF\lib\ folder (1).
  • Add the jboss-web.xml file to \archiva.war\WEB-INF\ folder

If you follow these steps, just deploy the application, copying the archiva.war to $JBOSS_HOME/server/<instance_name>/deploy folder and that’s it!

Send your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


apache, archiva, jboss, maven


, , ,