Archiva On GlassFish with Derby

Based on Archiva on GlassFish with mySQL but a convenient copy past guide for installing Archiva On GlassFish with Derby.
Glasfish 3.0.1 was used when compiling this.

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>
        <jvm-options>-Dappserver.home=${com.sun.aas.installRoot}/domains/domain1</jvm-options>
    ...
    
  • 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="<where you want your dbs>/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="<where you want your dbs>/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"/>

...

</server>

</servers>
  • Now restart you Glassfish server, and open the archiva location. The last thing you have to do is create the admin user (tongue)