Woohoo! I got it to work. Just in case somebody wants to know how...

(I'm running the 'default' JBoss configuration.)

1. copy archiva-webapp/src/main/webapp/WEB-INF/lib/derby-10.1.3.1.jar
into $JBOSS_HOME/server/default/lib;

2. create $JBOSS_HOME/server/default/deploy/derby-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
     <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
     <!-- Datasources are not available outside the virtual machine -->
     <jndi-name>users</jndi-name>
     <!-- for in-process persistent db, saved when jboss stops. The
     org.jboss.jdbc.DerbyDatabase mbean is necessary for properly db
shutdown -->
     <connection-url>jdbc:derby:database/archiva;create=true</connection-url>
     <!-- The driver class -->
     <driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class>
     <!-- The login and password -->
     <user-name>sa</user-name>
     <password></password>
     <!-- The minimum connections in a pool/sub-pool. Pools are
lazily constructed on first use -->
     <min-pool-size>5</min-pool-size>
     <!-- The maximum connections in a pool/sub-pool -->
     <max-pool-size>20</max-pool-size>
     <!-- The time before an unused connection is destroyed -->
     <idle-timeout-minutes>5</idle-timeout-minutes>
     <!-- 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 -->
     <track-statements/>
  </local-tx-datasource>
</datasources>

3. edit archiva-webapp/src/main/webapp/WEB-INF/web.xml and add
<resource-ref>
 <res-ref-name>jdbc/users</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>
(somewhere between <web-app> and </web-app>);

4. create archiva-webapp/src/main/webapp/WEB-INF/jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
 <resource-ref>
   <res-ref-name>jdbc/users</res-ref-name>
   <jndi-name>java:/users</jndi-name>
 </resource-ref>
</jboss-web>

5. rerun 'mvn install' (to update the WAR with the updated web.xml and
jboss-web.xml);

6. deploy the new WAR and Archiva should work.

DISCLAIMER: I'm not, by any stretch of the word, an expert on JBoss so
this is probably not the *best* way to do it ... but it works. :-)

Reply via email to