### Install Static Configuration Example Source: https://github.com/apache/karaf/blob/main/examples/karaf-config-example/README.md Install the static configuration example feature. This will create and display the content of the org.apache.karaf.example.config.cfg file. ```bash karaf@root()> feature:install karaf-config-example-static ``` ```text felix.fileinstall.filename = file:/home/jbonofre/Workspace/karaf/assemblies/apache-karaf/target/apache-karaf-4.2.3-SNAPSHOT/etc/org.apache.karaf.example.config.cfg foo = bar hello = world org.apache.karaf.features.configKey = org.apache.karaf.example.config service.pid = org.apache.karaf.example.config ``` -------------------------------- ### Install Managed Configuration Example Source: https://github.com/apache/karaf/blob/main/examples/karaf-config-example/README.md Install the managed configuration example feature to test the dynamic configuration approach. ```bash karaf@root()> feature:install karaf-config-example-managed ``` -------------------------------- ### Install Upload Servlet Example Source: https://github.com/apache/karaf/blob/main/examples/karaf-servlet-example/README.md Install the 'karaf-servlet-example-upload' feature to deploy the upload servlet example. ```bash karaf@root()> feature:install karaf-servlet-example-upload ``` -------------------------------- ### Install SOAP Example Client Source: https://github.com/apache/karaf/blob/main/examples/karaf-soap-example/README.md Install the feature that provides the SOAP client stub. ```bash karaf@root()> feature:install karaf-soap-example-client ``` -------------------------------- ### Start Bundle from OBR Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/obr.adoc The `obr:start` command installs a bundle and its dependencies, then starts all installed bundles. It is equivalent to `obr:deploy -s`. Specify bundles by symbolic name and optionally version. ```shell karaf@root()> obr:start org.ops4j.pax.web.samples.helloworld-hs ``` ```shell karaf@root()> obr:start org.apache.karaf.wrapper.core,4.0.0 ``` ```shell karaf@root()> obr:start org.apache.karaf.wrapper.core,4.0.0 org.apache.karaf.wrapper.command,4.0.0 ``` -------------------------------- ### Install HTTP Resource Example Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-http-resource-example/README.md Install the 'karaf-http-resource-example-whiteboard' feature to deploy the HTTP resource bundle. ```bash karaf@root()> feature:install karaf-http-resource-example-whiteboard ``` -------------------------------- ### Install Websocket Example Bundle Source: https://github.com/apache/karaf/blob/main/examples/karaf-websocket-example/README.md Deploy the compiled websocket example bundle into your running Karaf instance. ```bash karaf@root()> bundle:install -s mvn:org.apache.karaf.examples/karaf-websocket-example/LATEST ``` -------------------------------- ### Install Camel Blueprint Example Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-camel-example/README.md Install the Camel Blueprint DSL feature into Karaf. This will start the Camel routes defined using the Blueprint DSL. ```bash karaf@root()> feature:install karaf-camel-example-blueprint ``` -------------------------------- ### Install Service Provider Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-jdbc-example/README.md Install the service provider feature for the JDBC example. ```bash karaf@root()> feature:install karaf-jdbc-example-provider ``` -------------------------------- ### Install Blueprint Example Provider Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-blueprint-example/README.md Install the feature that provides the BookingService implementation using Blueprint. ```bash feature:install karaf-blueprint-example-provider ``` -------------------------------- ### Install SOAP Example Blueprint Provider Source: https://github.com/apache/karaf/blob/main/examples/karaf-soap-example/README.md Install the feature that provides the SOAP service implementation using Blueprint. ```bash karaf@root()> feature:install karaf-soap-example-blueprint ``` -------------------------------- ### Install Servlet Example using Annotation Source: https://github.com/apache/karaf/blob/main/examples/karaf-servlet-example/README.md Install the 'karaf-servlet-example-annotation' feature to register a servlet using Servlet 3.0 annotations. ```bash karaf@root()> feature:install karaf-servlet-example-annotation ``` -------------------------------- ### Install Servlet Example using Blueprint Source: https://github.com/apache/karaf/blob/main/examples/karaf-servlet-example/README.md Install the 'karaf-servlet-example-blueprint' feature to register a servlet using the Servlet whiteboard pattern with Blueprint. ```bash karaf@root()> feature:install karaf-servlet-example-blueprint ``` -------------------------------- ### Install Camel Java Example Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-camel-example/README.md Install the Camel Java DSL feature into Karaf. This will start the Camel routes defined using the Java DSL. ```bash karaf@root()> feature:install karaf-camel-example-java ``` -------------------------------- ### Install Client Feature in Karaf Source: https://github.com/apache/karaf/blob/main/examples/karaf-bundle-example/README.md Install the bundle example client feature to deploy the service consumer. ```bash karaf@root()> feature:install karaf-bundle-example-client ``` -------------------------------- ### Install Blueprint Example Client Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-blueprint-example/README.md Install the feature that consumes the BookingService using a Blueprint XML descriptor. ```bash feature:install karaf-blueprint-example-client ``` -------------------------------- ### Install Karaf Configuration Example Feature Repository Source: https://github.com/apache/karaf/blob/main/examples/karaf-config-example/README.md Register the features repository for the Karaf configuration examples on a running Karaf instance. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-config-example-features/LATEST/xml ``` -------------------------------- ### Install Servlet Example using Direct Registration Source: https://github.com/apache/karaf/blob/main/examples/karaf-servlet-example/README.md Install the 'karaf-servlet-example-registration' feature to register a servlet directly into the Karaf HTTP service. ```bash karaf@root()> feature:install karaf-servlet-example-registration ``` -------------------------------- ### Install KAR File with No Start Option Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/kar.adoc Optionally use the `--no-start` flag with `kar:install` to prevent bundles within the KAR from starting automatically after installation. ```bash karaf@root()> kar:install --no-start file:/tmp/my-kar-1.0-SNAPSHOT.kar ``` -------------------------------- ### Deploy Karaf GraphQL Example Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-graphql-example/README.md Add the example's feature repository to a running Karaf instance and then install the feature. This makes the GraphQL example available. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-graphql-example-features/LATEST/xml karaf@root()> feature:install karaf-graphql-example ``` -------------------------------- ### Install Servlet Example using SCR Source: https://github.com/apache/karaf/blob/main/examples/karaf-servlet-example/README.md Install the 'karaf-servlet-example-scr' feature to register a servlet using the Servlet whiteboard pattern with SCR. ```bash karaf@root()> feature:install karaf-servlet-example-scr ``` -------------------------------- ### Install SOAP Example SCR Provider Source: https://github.com/apache/karaf/blob/main/examples/karaf-soap-example/README.md Install the feature that provides the SOAP service implementation using SCR. ```bash karaf@root()> feature:install karaf-soap-example-scr ``` -------------------------------- ### Install Provider Feature in Karaf Source: https://github.com/apache/karaf/blob/main/examples/karaf-bundle-example/README.md Install the bundle example provider feature to deploy the service implementation. ```bash karaf@root()> feature:install karaf-bundle-example-provider ``` -------------------------------- ### Install and List WABs Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/webcontainer.adoc This section shows how to install a Web Application Bundle (WAB) using the `bundle:install` command and then list all deployed WABs with their context paths and base URLs using the `web:wab-list` command. ```bash karaf@root()> bundle:install -s mvn:org.apache.karaf/manual/4.4.0 ``` ```bash karaf@root()> web:wab-list Context Path │ Bundle ID │ Symbolic Name │ State │ Base URL ───────────────┼───────────┼─────────────────────────┼──────────┼──────────────────────────────────── /documentation │ 72 │ org.apache.karaf.manual │ Deployed │ http://127.0.0.1:8181/documentation ``` -------------------------------- ### Deploy and Start Bundle from OBR Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/obr.adoc The `obr:deploy -s` option installs and starts a bundle along with its dependencies. This is a convenient way to deploy and immediately activate functionality. ```shell karaf@root()> obr:deploy org.ops4j.pax.web.samples.helloworld-hs -s ``` -------------------------------- ### Install the Example Feature in Karaf Source: https://github.com/apache/karaf/blob/main/examples/karaf-url-namespace-handler-example/README.md Install the custom URL namespace handler feature into your Karaf instance. This activates the handler and its associated functionality. ```bash karaf@root()> feature:install karaf-url-namespace-handler-example ``` -------------------------------- ### Install Command Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-jdbc-example/README.md Install the feature that provides the Karaf shell commands for the JDBC example. ```bash karaf@root()> feature:install karaf-jdbc-example ``` -------------------------------- ### Install WAR using Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-war-example/README.md Install the 'karaf-war-example' feature, which automatically includes the WAR and its dependencies. ```bash karaf@root()> feature:install karaf-war-example ``` -------------------------------- ### Use the Custom URL Handler Source: https://github.com/apache/karaf/blob/main/examples/karaf-url-namespace-handler-example/README.md Install a bundle using the custom `example:*` URL scheme. This demonstrates the functionality of the registered URL namespace handler, which displays a greeting message. ```bash karaf@root()> bundle:install example:mvn:commons-lang/commons-lang/2.6 Thanks for using the Example URL ! Bundle ID: 44 ``` -------------------------------- ### Install WAR using bundle:install and webbundle protocol Source: https://github.com/apache/karaf/blob/main/examples/karaf-war-example/README.md Install a WAR file directly using the 'bundle:install' command with the 'webbundle' protocol, specifying the context path. ```bash karaf@root()> bundle:install -s webbundle:mvn:org.apache.karaf.examples/karaf-war-example-webapp/LATEST/war?Web-ContextPath=example ``` -------------------------------- ### Start Apache Karaf Runtime Source: https://github.com/apache/karaf/blob/main/assemblies/apache-karaf/src/main/distribution/README.md Run this command to start the Karaf runtime. Ensure Java SE 11 or higher is installed. ```bash bin/karaf ``` -------------------------------- ### Install Karaf Deployer Service Source: https://github.com/apache/karaf/blob/main/examples/karaf-deployer-example/README.md Install the necessary SCR feature and then deploy the example bundle to a running Karaf instance. This makes the deployer service active. ```bash karaf@root()> feature:install scr karaf@root()> bundle:install -s mvn:org.apache.karaf.examples/karaf-deployer-example/LATEST ``` -------------------------------- ### Install Client Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-scr-example/README.md Install the client feature to deploy the service provider and the client bundle. ```bash feature:install karaf-scr-example-client ``` -------------------------------- ### Start Instance Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/instances.adoc Starts a Karaf instance. ```APIDOC ## startInstance ### Description Starts a specified instance. ### Method APIDOC ### Endpoint APIDOC ### Parameters #### Path Parameters - **instanceName** (string) - Required - The name of the instance to start. - **options** (string) - Optional - Java options to use when starting the instance. - **wait** (boolean) - Optional - If true, waits for the instance to reach the 'Started' state. - **debug** (boolean) - Optional - If true, starts the instance in debug mode. ``` -------------------------------- ### Access Servlet Example URL Source: https://github.com/apache/karaf/blob/main/examples/karaf-servlet-example/README.md Access the registered servlet on the specified URL, regardless of the installation method used. ```bash http://localhost:8181/servlet-example ``` -------------------------------- ### Install ActiveMQ JMS Example Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-jms-example/README.md Install the feature that sets up an embedded ActiveMQ broker within Karaf. ```bash karaf@root()> feature:install karaf-jms-example-activemq ``` -------------------------------- ### Install and Manage Windows Service with winsw Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/os-integration.adoc Install, start, and stop Karaf as a Windows service using the winsw executable after renaming and customizing configuration files. ```bash C:\opt\apache-karaf-4\bin\contrib> karaf-4.exe install C:\opt\apache-karaf-4\bin\contrib> karaf-4.exe start ``` -------------------------------- ### Minimal Karaf Assembly POM Example Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/developer-guide/custom-distribution.adoc A basic Maven POM file demonstrating the setup for a minimal Karaf distribution using the karaf-assembly packaging. ```xml 4.0.0 ... org.apache.karaf apache-karaf-minimal ${project.version} ``` -------------------------------- ### Start Karaf Server on Windows Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/quick-start.adoc Use this command to start the Apache Karaf server on a Windows environment. Ensure you are in the Karaf installation directory. ```batch bin\karaf.bat ``` -------------------------------- ### Install the Log Appender Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-log-appender-example/README.md Install the 'karaf-log-appender-example' feature to enable the custom log appender. ```bash karaf@root()> feature:install karaf-log-appender-example ``` -------------------------------- ### Karaf Bundle List Command Help Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/quick-start.adoc To get detailed information about a specific command, use the '--help' option. This example shows the help output for the 'bundle:list' command. ```text karaf@root()> bundle:list --help DESCRIPTION bundle:list Lists all installed bundles. SYNTAX bundle:list [options] [ids] ARGUMENTS ids The list of bundle (identified by IDs or name or name/version) separated by whitespaces OPTIONS -name, -n Show bundle name -u Shows the update locations -r Shows the bundle revisions --no-ellipsis -l Show the locations -s Shows the symbolic name --context, -c Use the given bundle context (defaults to 0) --help Display this help message -t Specifies the bundle start-level; bundles with a start-level less than this value will not get printed out. --no-format Disable table rendered output ``` -------------------------------- ### Register Features Repository in Karaf Source: https://github.com/apache/karaf/blob/main/examples/karaf-bundle-example/README.md Add the example's features repository to your Karaf instance to enable feature installation. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-bundle-example-features/LATEST/xml ``` -------------------------------- ### Install KAR File Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/kar.adoc Use `kar:install` with the KAR file URL to deploy it. This command uncompresses the KAR, registers its features, and installs them. ```bash karaf@root()> kar:install file:/tmp/my-kar-1.0-SNAPSHOT.kar ``` -------------------------------- ### Install WebConsole Feature Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/webconsole.adoc Install the 'webconsole' feature to enable the WebConsole. Ensure a Http Service feature like 'http' or 'felix-http' is installed first. ```bash karaf@root()> feature:install http karaf@root()> feature:install webconsole ``` -------------------------------- ### Install karaf-jaas-example-app Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-jaas-example/README.md Installs the application bundle that provides a secured shell command. Use this to test service-level security. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-jaas-example-features/LATEST/xml karaf@root()> feature:install karaf-jaas-example-app ``` -------------------------------- ### Register Features Repository in Karaf Source: https://github.com/apache/karaf/blob/main/examples/karaf-url-namespace-handler-example/README.md Add the example's features repository to your running Karaf instance using this command. This makes the feature available for installation. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-url-namespace-handler-example-features/LATEST/xml ``` -------------------------------- ### Install WAR Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-war-example/README.md Install the 'war' feature to enable WAR deployment capabilities in Karaf. ```bash karaf@root()> feature:install war ``` -------------------------------- ### Install Configuration Listener Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-config-example/README.md Command to install the feature that provides a configuration listener. ```shell karaf@root()> feature:install karaf-config-example-listener ``` -------------------------------- ### Karaf Wrapper Configuration Example Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/os-integration.adoc An example of the generated etc/karaf-wrapper.conf file, used for configuring the Service Wrapper. ```properties # This file is generated by the wrapper:install command. # The wrapper will only load variables starting with "wrapper.". # All other variables are passed to the karaf script. # # wrapper.java.command=java # wrapper.java.parameters=-Xms128m -Xmx128m -Djava.awt.headless=true # wrapper.java.classpath=... (populated by the wrapper:install command) # wrapper.java.classpath.append=... (populated by the wrapper:install command) # wrapper.app.parameter.1=... (populated by the wrapper:install command) # wrapper.app.parameter.2=... (populated by the wrapper:install command) # wrapper.app.parameter.3=... (populated by the wrapper:install command) # wrapper.app.parameter.4=... (populated by the wrapper:install command) # wrapper.app.parameter.5=... (populated by the wrapper:install command) # wrapper.app.parameter.6=... (populated by the wrapper:install command) # wrapper.app.parameter.7=... (populated by the wrapper:install command) # wrapper.app.parameter.8=... (populated by the wrapper:install command) # wrapper.app.parameter.9=... (populated by the wrapper:install command) # wrapper.app.parameter.10=... (populated by the wrapper:install command) # wrapper.java.additional.1=... (populated by the wrapper:install command) # wrapper.java.additional.2=... (populated by the wrapper:install command) # wrapper.java.additional.3=... (populated by the wrapper:install command) # wrapper.java.additional.4=... (populated by the wrapper:install command) # wrapper.java.additional.5=... (populated by the wrapper:install command) # wrapper.java.additional.6=... (populated by the wrapper:install command) # wrapper.java.additional.7=... (populated by the wrapper:install command) # wrapper.java.additional.8=... (populated by the wrapper:install command) # wrapper.java.additional.9=... (populated by the wrapper:install command) # wrapper.java.additional.10=... (populated by the wrapper:install command) # wrapper.java.additional.11=... (populated by the wrapper:install command) # wrapper.java.initmemory=512 # wrapper.java.maxmemory=512 # wrapper.logfile=../log/wrapper.log # wrapper.logfile.loglevel=INFO # wrapper.logfile.maxsize=10m # wrapper.logfile.maxfiles=5 # wrapper.syslog.loglevel=none # wrapper.ntservice.name=karaf # wrapper.ntservice.displayname=karaf # wrapper.ntservice.description=Apache Karaf # wrapper.ntservice.starttype=AUTO_START ``` -------------------------------- ### Start Docker Container Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/docker.adoc The `docker:start` command initiates a stopped Docker container. Specify the container name or ID to start. ```shell karaf@root()> docker:start my-container ``` -------------------------------- ### Install Simple MBean Registration Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-mbean-example/README.md Install the feature for MBean registration using Karaf utilities. ```bash karaf@root()> feature:install karaf-mbean-example-simple ``` -------------------------------- ### Install a Feature Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/provisioning.adoc Installs a specified feature. If only the feature name is provided, the latest available version will be installed. Use `-v` for verbose output and `-t` for simulation. ```bash karaf@root()> feature:install eventadmin ``` ```bash karaf@root()> feature:install -t -v eventadmin ``` ```bash karaf@root()> feature:install eventadmin/4.4.0 ``` ```bash karaf@root()> feature:install -v eventadmin ``` -------------------------------- ### Register Blueprint Example Features Repository Source: https://github.com/apache/karaf/blob/main/examples/karaf-blueprint-example/README.md Add the blueprint example features repository to a running Karaf instance. ```bash feature:repo-add mvn:org.apache.karaf.examples/karaf-blueprint-example-features/LATEST/xml ``` -------------------------------- ### Add Example Features Repository Source: https://github.com/apache/karaf/blob/main/examples/karaf-scr-example/README.md Register the Karaf SCR example features repository with your running Karaf instance. ```bash feature:repo-add mvn:org.apache.karaf.examples/karaf-scr-example-features/LATEST/xml ``` -------------------------------- ### Install Runnable Service Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-scheduler-example/README.md Install the core runnable service feature after adding the repository. ```bash karaf@root()> feature:install karaf-scheduler-example ``` -------------------------------- ### Register Camel Example Features Repository Source: https://github.com/apache/karaf/blob/main/examples/karaf-camel-example/README.md Register the features repository for the Camel example in Karaf. This makes the example features available for installation. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-camel-example-features/LATEST/xml ``` -------------------------------- ### Install Blueprint MBean Registration Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-mbean-example/README.md Install the feature for MBean registration using Blueprint. ```bash karaf@root()> feature:install karaf-mbean-example-blueprint ``` -------------------------------- ### Add SOAP Example Features Repository Source: https://github.com/apache/karaf/blob/main/examples/karaf-soap-example/README.md Register the features repository for the SOAP example in a running Karaf instance. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-soap-example-features/LATEST/xml ``` -------------------------------- ### Display wrapper:install command help Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/os-integration.adoc View the available options and syntax for the wrapper:install command, which registers Apache Karaf as a system service. ```bash karaf@root()> wrapper:install --help ``` -------------------------------- ### Wrap Deployer Example Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/deployers.adoc Demonstrates how the wrap deployer handles a non-OSGi JAR file, transforming it into an OSGi bundle. ```shell karaf@root()> la|grep -i commons-lang 80 | Active | 80 | 2.3 | commons-lang ``` -------------------------------- ### Install karaf-jaas-example-wab Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-jaas-example/README.md Installs the web application bundle that uses HTTP basic authentication. Access it via a web browser. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-jaas-example-features/LATEST/xml karaf@root()> feature:install karaf-jaas-example-wab ``` -------------------------------- ### Get Instance Status Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/instances.adoc Use this command to retrieve the current status of a specific Karaf instance. The status can be Stopped, Starting, or Started. ```shell karaf@root()> instance:status test ``` -------------------------------- ### Deploy Bundle from OBR Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/obr.adoc The `obr:deploy` command installs a bundle from the OBR and automatically resolves and installs its required dependencies. Bundles are installed but not started by default. Specify bundles by symbolic name and optionally version. ```shell karaf@root()> obr:deploy org.ops4j.pax.web.samples.helloworld-hs ``` ```shell karaf@root()> obr:deploy org.apache.karaf.wrapper.core,4.0.0 ``` ```shell karaf@root()> obr:deploy org.apache.karaf.wrapper.core,4.0.0 org.apache.karaf.wrapper.command,4.0.0 ``` -------------------------------- ### File Install Configuration Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/deployers.adoc Configure the file installation directory, temporary directory, polling interval, and start/active levels for bundle deployment. ```properties felix.fileinstall.dir = ${karaf.base}/deploy felix.fileinstall.tmpdir = ${karaf.data}/generated-bundles felix.fileinstall.poll = 1000 felix.fileinstall.start.level = 80 felix.fileinstall.active.level = 80 felix.fileinstall.log.level = 3 ``` -------------------------------- ### Query Book by ID via HTTP GET Source: https://github.com/apache/karaf/blob/main/examples/karaf-graphql-example/README.md Test the GraphQL API by sending HTTP GET requests to the /graphql endpoint. This example retrieves a book by its ID. ```http GET http://localhost:8181/graphql?query={ bookById(id:"1") { name }} ``` ```http GET http://localhost:8181/graphql?query={ bookById(id:"2") { name id authorId pageCount}} ``` -------------------------------- ### List All Configurations Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/configuration.adoc Use the `config:list` command without arguments to display all available configurations, including their PID, bundle location, and properties. ```shell karaf@root()> config:list ---------------------------------------------------------------- Pid: org.apache.karaf.service.acl.command.system.start-level BundleLocation: mvn:org.apache.karaf.shell/org.apache.karaf.shell.console/4.0.0 Properties: service.guard = (&(osgi.command.scope=system)(osgi.command.function=start-level)) * = * start-level = admin # admin can set any start level, including < 100 start-level[/[^0-9]*/] = viewer # viewer can obtain the current start level execute[/.*/,/[^0-9]*/] = viewer # viewer can obtain the current start level execute = admin # admin can set any start level, including < 100 service.pid = org.apache.karaf.service.acl.command.system.start-level start-level[/.*[0-9][0-9][0-9]+.*/] = manager # manager can set startlevels above 100 execute[/.*/,/.*[0-9][0-9][0-9]+.*/] = manager # manager can set startlevels above 100 ---------------------------------------------------------------- Pid: org.apache.karaf.log BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/4.0.0 Properties: service.pid = org.apache.karaf.log size = 500 pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg ... ``` -------------------------------- ### Example Docker Build Output Source: https://github.com/apache/karaf/blob/main/assemblies/docker/README.md This is an example of the output you can expect when building a multi-platform Docker image for Apache Karaf. It shows the download, buildx check, and build progress. ```text Downloading apache-karaf-4.2.9.tar.gz from https://downloads.apache.org/karaf/4.2.9/ Checking if buildx installed... Found buildx {github.com/docker/buildx v0.3.1-tp-docker 6db68d029599c6710a32aa7adcba8e5a344795a7} on your docker system Starting build of the docker image for the platform linux/arm64,linux/arm/v7,linux/amd64 [+] Building 15.8s (16/16) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 32B 0.0s => [internal] load .dockerignore 0.1s => => transferring context: 2B 0.0s => [linux/arm64 internal] load metadata for docker.io/library/openjdk:8u212-jre-alpine 2.5s => [linux/arm/v7 internal] load metadata for docker.io/library/openjdk:8u212-jre-alpine 2.6s => [linux/amd64 internal] load metadata for docker.io/library/openjdk:8u212-jre-alpine 2.5s => [linux/amd64 1/3] FROM docker.io/library/openjdk:8u212-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 0.0s => => resolve docker.io/library/openjdk:8u212-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 0.0s ``` -------------------------------- ### Create Alias in Karaf Console Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/console.adoc Define custom aliases for commands using the 'alias' command. This example creates an alias for listing installed features. ```shell karaf@root()> alias "list-features-installed = { feature:list -i }" ``` -------------------------------- ### Kerberos krb5 Configuration File Example Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/developer-guide/security-framework.adoc A simple example of a krb5 configuration file. This file is required when using the Krb5LoginModule and must be specified via the 'java.security.krb5.conf' system property. ```ini [libdefaults] default_realm = EXAMPLE.COM dns_lookup_realm = false dns_lookup_kdc = false ticket_lifetime = 24h renew_lifetime = 365d forwardable = true [realms] EXAMPLE.COM = { kdc = kdc.example.com admin_server = kdc.example.com default_domain = example.com } [domain_realm] .example.com = EXAMPLE.COM example.com = EXAMPLE.COM ``` -------------------------------- ### Download and Install JMXMP Connector Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/monitoring.adoc Download the JMXMP connector JAR and place it in the lib/boot directory. Then, restart Karaf. ```bash cd lib/boot curl -O https://repo1.maven.org/maven2/org/glassfish/external/opendmk_jmxremote_optional_jar/1.0-b01-ea/opendmk_jmxremote_optional_jar-1.0-b01-ea.jar cd ../../bin ./karaf ``` -------------------------------- ### Configure Karaf Client Goal Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/developer-guide/karaf-maven-plugin.adoc Configure the karaf-maven-plugin to execute commands on a running Karaf instance via SSH. This example shows how to install a feature named 'foo'. ```xml client client 1 feature:install foo ``` -------------------------------- ### Deploy Dump Provider and SCR Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-dump-example/README.md Install the Service Component Runtime (SCR) feature and the dump provider bundle onto a running Karaf instance. The '-s' flag starts the bundle immediately. ```bash karaf@root()> feature:install scr karaf@root()> bundle:install -s mvn:org.apache.karaf.examples/karaf-dump-example/LATEST ``` -------------------------------- ### Install karaf-jaas-example-war Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-jaas-example/README.md Installs a WAR file containing a secure web application. Access it via a web browser to test WAR security. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-jaas-example-features/LATEST/xml karaf@root()> feature:install karaf-jaas-example-war ``` -------------------------------- ### Install Camel Features and Deploy Application Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/quick-start.adoc Installs the Camel feature repository, deploys a sample Camel blueprint application, and creates the application's XML configuration file. ```bash feature:repo-add camel feature:install deployer camel-blueprint aries-blueprint cat > deploy/example.xml < Message at ${date:now:yyyy-MM-dd HH:mm:ss} END ``` -------------------------------- ### Install Scheduler Feature Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/scheduler.adoc Installs the scheduler feature in Apache Karaf. This also installs the scheduler command group. ```bash karaf@root()> feature:install scheduler ``` -------------------------------- ### Install Bundle in Karaf Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/developer-guide/creating-bundles.adoc Install an OSGi bundle into Karaf using the bundles:install command with the mvn: syntax. ```bash bundles:install -s mvn:osgi.commons-lang/osgi.commons-lang/2.4 ``` -------------------------------- ### Install Pax Web Whiteboard Extender Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/http.adoc Install the Pax Web whiteboard extender feature using the `feature:install` command. This enhances the http feature and is often installed by default with the `felix-http` feature. ```shell root@karaf> feature:install http-whiteboard ``` -------------------------------- ### Example HTTP Proxy Configuration in settings.xml Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/urls.adoc This XML snippet shows how the `maven:http-proxy` command configures the `` section within the `settings.xml` file, including details like host, port, username, and non-proxy hosts. ```xml discord {fHl8U3pINkEH7RR1CufRT+utj5gJHfqsRgd6wTo92Eo=} 3128 proxy.everfree.forest 127.*|192.168.*|localhost my.proxy ``` -------------------------------- ### Install JDBC Feature Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/jdbc.adoc Installs the core JDBC feature in Karaf. This also automatically installs the necessary Pax JDBC core features. ```bash karaf@root()> feature:install jdbc ``` -------------------------------- ### Install EclipseLink Persistence Engine Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/jpa.adoc Use this command to install the EclipseLink persistence engine. This command installs the base 'jpa' feature along with EclipseLink. ```bash karaf@root()> feature:install eclipselink ``` -------------------------------- ### Install Wrapped Bundle with Manifest Headers Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/deployers.adoc Install a bundle by wrapping a JAR, specifying manifest headers like `Bundle-SymbolicName` and `Bundle-Version` as URL parameters. Note that `$` and `&` may require escaping depending on the OS. ```shell karaf@root()> bundle:install -s 'wrap:mvn:jboss/jbossall-client/4.2.3.GA\$Bundle-SymbolicName=jbossall-client\&Bundle-Version=4.2.3.GA&Export-Package=org.jboss.remoting;version="4.2.3.GA",!*' ``` -------------------------------- ### Install Hibernate Persistence Engine Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/jpa.adoc Use this command to install the Hibernate persistence engine. This command installs the base 'jpa' feature along with Hibernate. ```bash karaf@root()> feature:install hibernate ``` -------------------------------- ### Install Feature without Auto-Refresh Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/provisioning.adoc Installs a feature and disables the automatic refresh of already installed bundles that are part of the feature. Use `-r` to prevent refresh. ```bash karaf@root()> feature:install -v -r eventadmin ``` -------------------------------- ### Managed Factory Configuration Example Source: https://github.com/apache/karaf/blob/main/examples/karaf-config-example/README.md Create a configuration file for a managed service factory. This example shows how to define a base PID and create a specific configuration instance. ```properties hello=world ``` -------------------------------- ### List Servlets for WebConsole Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/webcontainer.adoc This example shows how to list servlets specifically for the Apache Karaf WebConsole using the `web:servlet-list` command. ```shell karaf@root()> web:servlet-list Bundle ID │ Name │ Class │ Context Path(s) │ URLs │ Type │ Context Filter ──────────┼───────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────┼─────────────────┼───────────────────────┼─────────────┼─────────────── 93 │ default-d975426d-f19e-4b5a-a889-80603beb34c9 │ org.ops4j.pax.web.service.jetty.internal.web.JettyResourceServlet │ / │ /system/console/res/* │ HttpService │ - ``` -------------------------------- ### Install OpenJPA Persistence Engine Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/jpa.adoc Use this command to install the Apache OpenJPA persistence engine. This command installs the base 'jpa' feature along with OpenJPA. ```bash karaf@root()> feature:install openjpa ``` -------------------------------- ### Define Bundle Start Level in Feature XML Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/provisioning.adoc Specify the start level for bundles within a feature definition. This ensures bundles are started in a specific order. ```xml mvn:com.mycompany.myproject/myproject-dao mvn:com.mycompany.myproject/myproject-service ``` -------------------------------- ### Add Karaf Servlet Example Features Repository Source: https://github.com/apache/karaf/blob/main/examples/karaf-servlet-example/README.md Register the example features repository in a running Karaf instance using this command. ```bash karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-servlet-example-features/LATEST/xml ``` -------------------------------- ### Install Provider Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-mbean-example/README.md Install the feature that provides the BookingService implementation. ```bash karaf@root()> feature:install karaf-mbean-example-provider ``` -------------------------------- ### Disable Automatic Bundle Start in Feature XML Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/provisioning.adoc Configure bundles within a feature to not start automatically by setting the 'start' attribute to 'false'. The bundle will remain in a resolved state. ```xml mvn:com.mycompany.myproject/myproject-dao mvn:com.mycompany.myproject/myproject-service ``` -------------------------------- ### Install Service Provider Feature Source: https://github.com/apache/karaf/blob/main/examples/karaf-command-example/README.md Install the feature that provides the BookingService implementation. ```bash karaf@root()> feature:install karaf-command-example-provider ``` -------------------------------- ### Install WebConsole for Testing Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/http.adoc Installs the 'webconsole' feature, which allows you to test the HTTP service. Access it via your browser at http://localhost:8181/system/console. ```bash root@karaf()> feature:install webconsole ``` -------------------------------- ### Install Karaf Features Source: https://github.com/apache/karaf/blob/main/examples/karaf-websocket-example/README.md Before deploying the bundle, install the necessary Karaf features. These provide the required HTTP service and websocket capabilities. ```bash karaf@root()> feature:install pax-web-jetty-websockets karaf@root()> feature:install pax-web-karaf karaf@root()> feature:install http karaf@root()> feature:install scr ``` -------------------------------- ### Install Karaf as a System Service Source: https://github.com/apache/karaf/blob/main/manual/src/main/asciidoc/user-guide/os-integration.adoc Execute the wrapper:install command to register Apache Karaf as a service or daemon on your system. This command detects the OS and creates necessary configuration files and scripts. ```bash karaf@root()> wrapper:install ```