4

I've deployed Archiva 2.2.0 on Glassfish 4.1.1 however something about the configuration is puzzling me.

I've followed the Glassfish specific guide here. and modified the domain.xml but I expected the embedded database (within Archiva WAR) to be used however it is not. In when I enable the Archiva war it fails with the error:

java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskExecutor#indexing': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin org.apache.archiva.scheduler.indexing.ArchivaIndexingTaskExecutor.managedRepositoryAdmin; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'managedRepositoryAdmin#default': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.apache.archiva.redback.role.RoleManager org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin.roleManager; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleManager': Invocation of init method failed; nested exception is javax.jdo.JDODataStoreException: Failed initialising database. Please check that your database JDBC driver is accessible, and the database URL and username/password are correct. Exception : Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused. java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused.

Basically I understand this to mean there is no database connection available however as I've configure domain.xml to use an embedded database I don't understand why I get this error.

The only way I get it to work is by starting the default database within Glassfish with the asadmin command start-database. Then archiva deploys but it uses the database sun-appserv-samples which is defined by default in domain.xml (see below)

The following is the relevant part of domain.xml

<resources>
<jdbc-resource pool-name="__TimerPool" object-type="system-admin" jndi-name="jdbc/__TimerPool"></jdbc-resource>
<jdbc-resource pool-name="DerbyPool" object-type="system-all" jndi-name="jdbc/__default"></jdbc-resource>
<jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" name="__TimerPool" res-type="javax.sql.XADataSource">
  <property name="databaseName" value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer"></property>
  <property name="connectionAttributes" value=";create=true"></property>
</jdbc-connection-pool>
<jdbc-connection-pool is-isolation-level-guaranteed="false" datasource-classname="org.apache.derby.jdbc.ClientDataSource" name="DerbyPool" res-type="javax.sql.DataSource">
  <property name="PortNumber" value="1527"></property>
  <property name="Password" value="APP"></property>
  <property name="User" value="APP"></property>
  <property name="serverName" value="localhost"></property>
  <property name="DatabaseName" value="sun-appserv-samples"></property>
  <property name="connectionAttributes" value=";create=true"></property>
</jdbc-connection-pool>
<connector-connection-pool max-pool-size="250" resource-adapter-name="jmsra" steady-pool-size="1" name="jms/__defaultConnectionFactory-Connection-Pool" connection-definition-name="javax.jms.ConnectionFactory"></connector-connection-pool>
<connector-resource pool-name="jms/__defaultConnectionFactory-Connection-Pool" object-type="system-all-req" jndi-name="jms/__defaultConnectionFactory"></connector-resource>
<context-service object-type="system-all" jndi-name="concurrent/__defaultContextService"></context-service>
<managed-executor-service object-type="system-all" jndi-name="concurrent/__defaultManagedExecutorService"></managed-executor-service>
<managed-scheduled-executor-service object-type="system-all" jndi-name="concurrent/__defaultManagedScheduledExecutorService"></managed-scheduled-executor-service>
<managed-thread-factory object-type="system-all" jndi-name="concurrent/__defaultManagedThreadFactory"></managed-thread-factory>
<jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" name="archivaUsersPool" res-type="javax.sql.XADataSource">
  <property name="databaseName" value="${com.sun.aas.instanceRoot}/lib/databases/archivausers"></property>
  <property name="connectionAttributes" value=";create=true"></property>
</jdbc-connection-pool>
<jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" name="archivaPool" res-type="javax.sql.XADataSource">
  <property name="databaseName" value="${com.sun.aas.instanceRoot}/lib/databases/archivapool"></property>
  <property name="connectionAttributes" value=";create=true"></property>
</jdbc-connection-pool>
<jdbc-resource pool-name="archivaUsersPool" jndi-name="jdbc/users"></jdbc-resource>
<jdbc-resource pool-name="archivaPool" jndi-name="jdbc/archiva"></jdbc-resource>
<mail-resource host="email.example.com" from="me@email.example.com" user="me" jndi-name="mail/Session"></mail-resource>

So my questions are:

  1. How can I get Archiva to work with an embedded database, I don't want to use the Glassfish one.
  2. Why when it cannot use the embedded database use anyone it can 'get a hold of'. Surely this is incorrect behaviour? There is nothing in domain.xml to link Archiva to the sun-appserv-samples database?
  3. Are the modifications I made to domain.xml correct?
D-Dᴙum
  • 7,689
  • 8
  • 58
  • 97

0 Answers0