6.6. Installing additional features

This chapter will demonstrate how to add additional features from a remote maven repository to a default installation of Karaf.

Last updated September 3, 2010 using Karaf 2.0.0

Adding additional maven repositories

The following steps will add in the missing OPS4J and Apache Snapshot maven repositories. Note - this has been fixed in the 1.1.0 of ServiceMix Kernel release and can be skipped.

  1. Edit the following file -
    etc/org.ops4j.pax.url.mvn.cfg
    
  2. Update org.ops4j.pax.url.mvn.repositories to include the OPS4J and Apache Snapshot repos -
    org.ops4j.pax.url.mvn.repositories=file:${user.home}/.m2/repository@snapshots,http://repo1.maven.org/maven2,http://repository.ops4j.org/maven2,http://people.apache.org/repo/m2-snapshot-repository<at:var at:name="snapshots" />noreleases
    

Adding additional feature repositories

The following steps will add in the URLs for the Camel & ActiveMQ and Features locations.

  1. Start Karaf
    cd bin
    ./karaf or karaf.bat
    
  2. Add the following feature install locations
    karaf@root> features:addUrl mvn:org.apache.activemq/activemq-karaf/5.4.0/xml/features
    karaf@root> features:addUrl mvn:org.apache.camel.karaf/features/2.0.0/xml/features
    
    
  3. Verify the feature URLs were added -
    karaf@root> features:listUrl
    mvn:org.apache.camel.karaf/features/2.0.0/xml/features    valid
    mvn:org.apache.activemq/activemq-karaf/5.4.0/xml/features    valid
    mvn:org.apache.karaf/apache-karaf/2.0.1-SNAPSHOT/xml/features    valid
    

Installing a new feature (war)

The following steps will install the "war" feature (support for deploying WAR files with Servlet and JSPs into a Jetty server) into your Karaf instance.

  1. List the available features -
    karaf@root> features:list
     State        Name
    . . .
    [uninstalled] [2.0.0] obr                      karaf-2.0.0
    [uninstalled] [2.0.0] config                   karaf-2.0.0
    [uninstalled] [2.0.0] http                     karaf-2.0.0
    [uninstalled] [2.0.0] war                      karaf-2.0.0
    [uninstalled] [2.0.0] webconsole               karaf-2.0.0
    [installed  ] [2.0.0] ssh                      karaf-2.0.0
    
    . . .
    
  2. Install the war feature (and the sub-features it requires) -
    karaf@root> features:install war
    
  3. Verify the features were installed
    karaf@root> features:list
     State        Name
    . . .
    [installed  ] [2.0.0] http                     karaf-2.0.0
    [installed  ] [2.0.0] war                      karaf-2.0.0
    . . .
    
  4. Verify the installed bundles were started
    karaf@root> osgi:list
    START LEVEL 100
       ID   State         Blueprint      Level  Name
    . . .
    [  32] [Active     ] [            ] [   60] geronimo-servlet_2.5_spec (1.1.2)
    [  33] [Active     ] [            ] [   60] Apache ServiceMix :: Bundles :: jetty (6.1.22.2)
    [  34] [Active     ] [            ] [   60] OPS4J Pax Web - API (0.7.2)
    [  35] [Active     ] [            ] [   60] OPS4J Pax Web - Service SPI (0.7.2)
    [  36] [Active     ] [            ] [   60] OPS4J Pax Web - Runtime (0.7.2)
    [  37] [Active     ] [            ] [   60] OPS4J Pax Web - Jetty (0.7.2)
    [  38] [Active     ] [            ] [   60] OPS4J Pax Web - Jsp Support (0.7.2)
    [  39] [Active     ] [            ] [   60] OPS4J Pax Web - Extender - WAR (0.7.2)
    [  40] [Active     ] [            ] [   60] OPS4J Pax Web - Extender - Whiteboard (0.7.2)
    [  41] [Active     ] [            ] [   60] OPS4J Pax Url - war:, war-i: (1.1.3)
    [  42] [Active     ] [Created     ] [   60] Apache Karaf :: WAR Deployer (2.0.0)
    . . .
    
  5. The Jetty server should now be listening on http://localhost:8181/, but with no published applications available.
    HTTP ERROR: 404
    NOT_FOUND
    RequestURI=/
    Powered by jetty://
    

Deploying a WAR to the installed web feature

The following steps will describe how to install a simple WAR file (with JSPs or Servlets) to the just installed web feature.

  1. To deploy a WAR (JSP or Servlet) to Jetty, update its MANIFEST.MF to include the required OSGi headers as described here -
    http://wiki.ops4j.org/confluence/display/ops4j/Pax+Web+Extender+-+War+-+OSGi-fy
  2. Copy the updated WAR (archive or extracted files) to the deploy directory.

#top

  • No labels