[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#881297: Notes on how karaf starts and what dependencies are needed



 1. Karaf boots from a small kernel and the rest are pulled in, and
    started, using maven.  Maven initially looks to a maven repository
    in the karaf distro (the "system" repository), if it doesn't find
    what it looks for there, it moves on to maven central and a couple
    of other maven repositories (the list of repositores can be modified
    at runtime, using commands in the karaf console)

 2. Karaf is started by the karaf script
     https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/filtered-resources/resources/bin/karaf

 3. The script uses environment variables that could be set from the
    outside (e.g. in a systemd control file or a sysv init script) to
    make karaf use other directories:
     KARAF_ETC
     KARAF_DATA
     KARAF_HOME
    there used to be a point in setting the KARAF_LOG directory as well
    (in my own debian package I had it set to /var/log/karaf in the
    4.0.x series of karaf), but logging is now handled by the pax
    logging JUL (which I guess is "java.util.logging") handler, and in
    debian with openjdk ends up in /var/log/syslog and KARAF_LOG is no
    longer used in the karaf script
    Suggested values for the environment variables:
     KARAF_HOME=/usr/share/karaf (or maybe /usr/share/java/karaf ?)
      - This is where the scripts should end up
      - The lib subdirectory is where the OSGi runtime finds its jar
        files
      - The lib/boot directory is where the OSGi runtime boots from
        - Could the jar files here be symlinks to jars installed by
          other debian packages?
      - This is also where the deploy directory is expected to be (the
        directory where bundles can be dropped to be installed as
        plugins) 
     KARAF_ETC=/etc/karaf
      - This is where the config files are
      - A problem: This directory will be written to and some files
        modified on each karaf start/stop. Their md5 sum will not change
        unless the config is changed, but their date will be changed
     KARAF_DATA=/var/lib/karaf
      - Will contain the persistent osgi runtime information (cached
        bundles and their states)
      - Removing the contents of this directory will return karaf to its
        pristine state (so "apt-get purge" should delete it)
      - Will contain the karaf tmp directory

 4. The script boots from a small CLASSPATH consisting of the contents
    of the $KARAF_HOME/lib/boot directory
      https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/filtered-resources/resources/bin/karaf#L73
    The contents of the lib/boot directory of karaf 4.1.4, is:
      -rw-r--r-- 1 sb sb 1440500 Dec 15 20:14 jna-4.5.0.jar
      -rw-r--r-- 1 sb sb 2324986 Dec 15 20:14 jna-platform-4.5.0.jar
      -rw-r--r-- 1 sb sb   31235 Dec 15 20:14 org.apache.karaf.diagnostic.boot-4.1.4.jar
      -rw-r--r-- 1 sb sb   18181 Dec 15 20:14 org.apache.karaf.jaas.boot-4.1.4.jar
      -rw-r--r-- 1 sb sb  150582 Dec 15 20:14 org.apache.karaf.main-4.1.4.jar
      -rw-r--r-- 1 sb sb  475256 Dec 15 20:14 org.osgi.core-6.0.0.jar

 5. The script adds a directory containing jar files to the
    java.endorsed.dirs system properties
      https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/filtered-resources/resources/bin/karaf#L158
      https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/filtered-resources/resources/bin/karaf#L297
    The contents of the lib/ext/ directory in karaf-4.1.4, is:
        -rw-r--r-- 1 sb sb   26366 Dec 15 20:14 javax.annotation-api-1.2.jar
        -rw-r--r-- 1 sb sb    9598 Dec 15 20:14 org.apache.karaf.exception-4.1.4.jar
        -rw-r--r-- 1 sb sb 2952198 Dec 15 20:14 org.apache.servicemix.bundles.xalan-2.7.2_3.jar
        -rw-r--r-- 1 sb sb  284590 Dec 15 20:14 org.apache.servicemix.bundles.xalan-serializer-2.7.2_1.jar
        -rw-r--r-- 1 sb sb 1400520 Dec 15 20:14 org.apache.servicemix.bundles.xerces-2.11.0_1.jar
        -rw-r--r-- 1 sb sb   65653 Dec 15 20:14 org.apache.servicemix.specs.activation-api-1.1-2.9.0.jar
        -rw-r--r-- 1 sb sb  121045 Dec 15 20:14 org.apache.servicemix.specs.jaxb-api-2.2-2.9.0.jar
        -rw-r--r-- 1 sb sb  261001 Dec 15 20:14 org.apache.servicemix.specs.jaxp-api-1.4-2.9.0.jar
        -rw-r--r-- 1 sb sb   73842 Dec 15 20:14 org.apache.servicemix.specs.jaxws-api-2.2-2.9.0.jar
        -rw-r--r-- 1 sb sb   49355 Dec 15 20:14 org.apache.servicemix.specs.saaj-api-1.3-2.9.0.jar
        -rw-r--r-- 1 sb sb   48782 Dec 15 20:14 org.apache.servicemix.specs.stax-api-1.2-2.9.0.jar

 6. The script adds a directory to the java.ext.dirs system properties
      https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/filtered-resources/resources/bin/karaf#L159
      https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/filtered-resources/resources/bin/karaf#L298
    The the lib/ext/ directory in karaf-4.1.4, is empty

 7. the $KARAF_HOME/system directory is the top of a maven repository
    containing 64 different jar files in the karaf 4.1.4 release.
    The repository in the system directory is referenced in two config files
      https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/resources/resources/etc/system.properties#L46
      https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg#L82

 8. The list of external maven repositories is in the
    org.ops4j.pax.url.mvn.repositories configuration setting
      https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg#L114

 9. The maven repository in /usr/share/maven-repository of debian
    installations could potentially be added to either of the
    configuration setting org.ops4j.pax.url.mvn.defaultRepositories or
    org.ops4j.pax.url.mvn.repositories, I don't know which one is most
    appropriate


Reply to: