Ok, I got it working. :-)

I should note that I have an extra requirement: I want to run Archiva
in the same JBoss instance. Both Continuum and Archiva use jdbc/users
so that clashes. I will change this to jdbc/continuum_users and
jdbc/archiva_users for Continuum and Archiva, respectively.

I already got Archiva working (still with jdbc/users), see

http://docs.codehaus.org/display/MAVENUSER/Archiva+on+JBoss

(thanks Wendy!).

On 12/15/06, Robert Dale <[EMAIL PROTECTED]> wrote:
Create a Derby datasource bound to java:comp/env/jdbc/continuum
or dig through the configuration to change the binding name.

The instructions below also include the setup of Archiva. Of course,
you can safely ignore those if you don't want to run Archiva.

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

1. copy derby-10.1.3.1.jar into $JBOSS_HOME/server/default/lib (it's
available in both continuum-webapp/src/main/webapp/WEB-INF/lib and
archiva-webapp/src/main/webapp/WEB-INF/lib);

2a. create $JBOSS_HOME/server/default/deploy/archiva-derby-ds.xml
(make sure the file name ends in '-ds.xml', the prefix is irrelevant)
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
 <local-tx-datasource>
    <jndi-name>archiva_users</jndi-name>
    
<connection-url>jdbc:derby:database/archiva_users;create=true</connection-url>
    <driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class>
    <user-name>sa</user-name>
    <password></password>
    <min-pool-size>5</min-pool-size>
    <max-pool-size>20</max-pool-size>
    <idle-timeout-minutes>5</idle-timeout-minutes>
    <track-statements/>
 </local-tx-datasource>
</datasources>

2b. create $JBOSS_HOME/server/default/deploy/continuum-derby-ds.xml
(again, make sure the file name ends in '-ds.xml', the prefix is
irrelevant)
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
     <jndi-name>continuum</jndi-name>
     <connection-url>jdbc:derby:database/continuum;create=true</connection-url>
     <driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class>
     <user-name>sa</user-name>
     <password></password>
     <min-pool-size>5</min-pool-size>
     <max-pool-size>20</max-pool-size>
     <idle-timeout-minutes>5</idle-timeout-minutes>
     <track-statements/>
  </local-tx-datasource>
  <local-tx-datasource>
     <jndi-name>continuum_users</jndi-name>
     
<connection-url>jdbc:derby:database/continuum_users;create=true</connection-url>
     <driver-class>org.apache.derby.jdbc.EmbeddedDriver</driver-class>
     <user-name>sa</user-name>
     <password></password>
     <min-pool-size>5</min-pool-size>
     <max-pool-size>20</max-pool-size>
     <idle-timeout-minutes>5</idle-timeout-minutes>
     <track-statements/>
  </local-tx-datasource>
</datasources>

3a. cd into the main archiva directory and run from there
mvn clean
for FILE in $(find . -name '.svn' -prune -o -type f | xargs grep -l
'jdbc/users'); do \
sed -e 's/jdbc\/users/jdbc\/archiva_users/' $FILE >$FILE.new; \
mv $FILE.new $FILE; \
done

3b. cd into the main continuum directory and run from there
mvn clean
for FILE in $(find . -name '.svn' -prune -o -type f | xargs grep -l
'jdbc/users'); do \
sed -e 's/jdbc\/users/jdbc\/continuum_users/' $FILE >$FILE.new; \
mv $FILE.new $FILE; \
done

4a. edit archiva-webapp/src/main/webapp/WEB-INF/web.xml and add
<resource-ref>
 <res-ref-name>jdbc/archiva_users</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>

4b. edit continuum-webapp/src/main/webapp/WEB-INF/web.xml and add
<resource-ref>
 <res-ref-name>jdbc/continuum</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
 <res-ref-name>jdbc/continuum_users</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>

5a. 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/archiva_users</res-ref-name>
  <jndi-name>java:/archiva_users</jndi-name>
</resource-ref>
</jboss-web>

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

6a. in archiva run 'mvn install' (to update the WAR with all our changes);

6b. in continuum run 'mvn install' (to update the WAR with all our changes);

7a. deploy the Archiva WAR (archiva-webapp/target);

7b. deploy the Continuum WAR (continuum-webapp/target);

That's it, both Archiva and Continuum should work now.

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