Installing Karaf

N.B. This installation only covers Windows servers.

Checking everything is setup correctly

To ensure everything is ready, open up a command prompt and type in the following: (ensuring that you include the ): "%JAVA_HOME%\bin\java" -version.

If installed correctly, it should say something like this, notice it says Corretto-8. If yours doesn’t say this then please recheck each of the instructions from this guide.

Check Java version

Check Java

Installing Karaf

Karaf is the OSGi container which hosts iGene. To install iGene, Karaf must first be running correctly as a service. This guide walks through installing and setting up Karaf as a service on Windows.

Download Karaf

Go to the website https://karaf.apache.org/index.html and download the binary zip for 4.2.3.

Download Karaf

Unzip the Karaf

Unzip Karaf and move it to the correct place (we’d suggest c:\Program Files). We recommend using 7Zip as the default zip program on Windows complained about path lengths being too long.

Unzip and move karaf

Connect Karaf with genial’s repository

Edit the file C:\Program Files\apache-karaf-4.2.3\etc\org.osps4j.pax.url.mvn.cfg and find the line that begins with org.ops4j.pax.url.mvn.repositories and change it so it looks like this:

org.ops4j.pax.url.mvn.repositories= \
  http://repo1.maven.org/maven2@id=central, \
  http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases, \
  https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases, \
  https://storage.googleapis.com/genial-maven-repository/releases, \
  https://storage.googleapis.com/genial-maven-repository/snapshots@snapshots

Update URL

Run Karaf as a service

There are three short steps to enable Karaf as a Windows service: Install the service-wrapper feature into Karaf, change some runtime settings regarding memory and then install the service.

Install Karaf Service Wrapper

Using Windows explorer, navigate to C:\Program Files\apache-karaf-4.2.3\bin\ and run the command karaf.bat

Alternativly, double-click on C:\Program Files\apache-karaf-4.2.3\bin\karaf.bat directly.

Run the following commands:

feature:install service-wrapper
wrapper:install

Install Service Wrapper

Correct Path and Change the memory settings

Open up the service wrapper config file \apache-karaf-4.2.3\etc\karaf-wrapper.conf with Notepad and make the following changes:

Replace all occurances of Program Files with PROGRA~1 and modify the below lines in the config file to say:

# Uncomment to enable JMX
wrapper.java.additional.n=-Dcom.sun.management.jmxremote.port=1616
wrapper.java.additional.n=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.n=-Dcom.sun.management.jmxremote.ssl=false

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=512

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=2048

Edit Wrapper Settings

Installing Karaf as a service

Close the existing Karaf command prompt Window, and open up a new command prompt as administrator and change to the location where Karaf is installed cd C:\Program Files\apache-karaf-4.2.3\, then run: bin\karaf-service.bat install.

Installing as Service

Start the service

Open services, locate Karaf in the list and start it.

Run as admin

Confirm the service is running

Next connect the client and ensure the service is working. Run the command apache-karaf-4.2.3\bin\client.bat, if it connects just type logout to close the connection.

Check Service

Troubleshooting

Problems with filename too long

If you are receiving errors unzipping or moving files around:

  1. Install and use 7Zip to extract the files
  2. Ensure you are not working on network drives. Copy and extract the zip files locally on the machine.

Problems starting the service

If there is a problem starting the service check the logs located in apache-karaf-4.2.3\data\log Logs

If in the logs you see the following error:

 Error: Could not find or load main class Files\apache-karaf-4.2.3\etc.java.util.logging.properties

then remove the service by running in a terminal C:\Program Files\apache-karaf-4.2.3\bin\karaf-service.bat remove and then carefully check through the instructions, ensuring that you’ve replaced the “Program Files” with “PROGRA~1”, then reinstall the service.