Thursday 24 June 2010

Archiva On GlassFish with Derby

I added the following to the archiva wiki, but keeping a copy here for reference and backup.
https://cwiki.apache.org/confluence/display/ARCHIVA/Archiva+On+GlassFish+with+Derby
(based on https://cwiki.apache.org/confluence/display/ARCHIVA/Archiva+on+GlassFish+with+mySQL)



Glassfish web configuration


Deploy the war file on your Glassfish server from the admin page (http://localhost:4848).
Or copy the the war file into your <GLASSFISH_FOLDER>/domains/domain1/autodeploy/archiva.war
Glassfish file configuration
Edit the file <GLASSFISH_FOLDER>/domains/domain1/config/domain.xml to add the following tags:

Go to Ressources -> JavaMail Sessions and create a new ressource with jndi-name='mail/Session', otherwise you will get "Error creating bean with name 'mailSession'" on startup. Or add it to the config file:

...
<resources>
<mail-resource from="me@email.example.com" host="email.example.com" jndi-name="mail/Session" object-type="user"
store-protocol="imap" store-protocol-class="com.sun.mail.imap.IMAPStore"
transport-protocol="smtp" transport-protocol-class="com.sun.mail.smtp.SMTPTransport"
user="me"/>
...

Set appserver.base and appserver.home properties


Ensure that the property appserver.base is set. Archiva uses this to locate log files.

...
<java-config ...
<jvm-options>-Dappserver.base=${com.sun.aas.installRoot}/domains/domain1
<jvm-options>-Dappserver.home=${com.sun.aas.installRoot}/domains/domain1
...


JDBC resources


...
</applications>
<resources>
<jdbc-resource pool-name="archivaUsersPool" jndi-name="jdbc/users" />
<jdbc-resource pool-name="archivaPool" jndi-name="jdbc/archiva" />
..

Connection pool


<jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="archivaUsersPool">
<property name="databaseName" value="/archiva/data/databases/users" />
<property name="connectionAttributes" value=";create=true" />
</jdbc-connection-pool>
<jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="archivaPool">
<property name="databaseName" value="/archiva/data/databases/arvhiva" />
<property name="connectionAttributes" value=";create=true" />
</jdbc-connection-pool>

Resources ref


<servers>
<server config-ref="server-config" name="server">
...
<resource-ref enabled="true" ref="jdbc/users"/>
<resource-ref enabled="true" ref="jdbc/archiva"/>
...


Now restart you Glassfish server, and open the archiva location. The last thing you have to do is create the admin user.

No comments:

Post a Comment