Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 3. Karaf Migration
This section covers the changes in the Karaf version from 2.x to 4.x.
3.1. Migrating application code Link kopierenLink in die Zwischenablage kopiert!
Applications will need to be recompiled to align with the new versions provided. Use the Maven Bill of Materials (BOM) file to migrate Maven dependencies to the new versions and see also Component Details.
3.2. Karaf Console Commands Link kopierenLink in die Zwischenablage kopiert!
The console commands have been renamed in Apache Karaf 4.x and differ from what they are in 2.x. The purpose is to standardize the naming convention.
All of the admin:* and instance:* commands (for managing child Karaf containers) are deprecated in Fuse 7.0 and will be removed in a future release. If you need to deploy multiple instances of a Karaf container on a single host, the recommended approach is to use OpenShift.
The following table lists the old commands and the new commands:
| Apache karaf 2.x | Apache karaf 4.x |
|---|---|
| dev:create-dump | dev:dump-create |
| features:add-url | feature:repo-add |
| features:chooseurl | feature:repo-add |
| features:info | feature:info |
| features:install | feature:install |
| features:listVersions | feature:version-list |
| features:list | feature:list |
| features:listRepositories | feature:repo-list |
| features:listUrl | feature:repo-list |
| features:refreshUrl | feature:repo-refresh |
| features:removeRepository | feature:repo-remove |
| features:removeUrl | feature:repo-remove |
| features:uninstall | feature:uninstall |
| jaas:pending | jaas:pending-list |
| jaas:realms | jaas:realm-list |
| jaas:users | jaas:user-list |
| jaas:manage | jaas:realm-manage |
| jaas:roleadd | jaas:role-add |
| jaas:roledel | jaas:role-delete |
| jaas:useradd | jaas:user-add |
| jaas:userdel | jaas:user-delete |
| config:propappend | config:property-append |
| config:propdel | config:property-delete |
| config:proplist | config:property-list |
| config:propset | config:property-set |
| dev:dynamic-import | bundle:dynamic-import |
| dev:framework | system:framework |
| dev:print-stack-traces | shell:stack-traces-print |
| dev:restart | system:shutdown |
| dev:show-tree | bundle:tree-show |
| dev:system-property | system:property |
| dev:wait-for-service | service:wait |
| dev:watch | bundle:watch |
| log:display-exception | log:exception-display |
| obr:addUrl | obr:url-add |
| obr:listUrl | obr:url-list |
| obr:refreshUrl | obr:url-refresh |
| obr:removeUrl | obr:url-remove |
| osgi:bundle-level | bundle:start-level |
| osgi:classes | bundle:classes |
| osgi:find-class | bundle:find-class |
| osgi:headers | bundle:headers |
| osgi:info | bundle:info |
| osgi:install | bundle:install |
| osgi:bundle-services | bundle:services |
| osgi:list | bundle:list |
| osgi:ls | service:list |
| osgi:name | system:name |
| osgi:refresh | bundle:refresh |
| osgi:resolve | bundle:resolve |
| osgi:restart | bundle:restart |
| osgi:shutdown | system:shutdown |
| osgi:start | bundle:start |
| osgi:start-level | bundle:start-level |
| osgi:stop | bundle:stop |
| osgi:uninstall | bundle:uninstall |
| osgi:update | bundle:update |
| osgi:version | system:version |
| packages:exports | package:exports |
| packages:imports | package:imports |
Fuse 7.0 defines aliases for the Karaf 2.x commands. So you can continue using the old commands.
3.3. JMX Object Names in Karaf 4.x Link kopierenLink in die Zwischenablage kopiert!
The JMX MBeans object names are renamed and the operations are dispatched in new MBeans.
The table below lists the old JMX MBeans object names and the respective new object names.
| Apache Karaf 2.x | Apache Karaf 4.x |
|---|---|
| org.apache.karaf:type=bundles,name=* | org.apache.karaf:type=bundle,name=* |
| org.apache.karaf:type=config,name=* | org.apache.karaf:type=config,name=* |
| org.apache.karaf:type=dev,name=* | org.apache.karaf:type=system,name=* |
| org;apache.karaf:type=log,name=* | org.apache.karaf:type=log,name=* |
| org.apache.karaf:type=obr,name=* | org.apache.karaf:type=obr,name=* |
| org.apache.karaf:type=packages,name=* | org.apache.karaf:type=package,name=* |
| org.apache.karaf:type=services,name=* | org.apache.karaf:type=service,name=* |
| org.apache.karaf:type=system,name=* | org.apache.karaf:type=system,name=* |
| org.apache.karaf:type=web,name=* | org.apache.karaf:type=web,name=* |
3.4. Karaf Migration Changes Link kopierenLink in die Zwischenablage kopiert!
This section covers the changes in Karaf 2.x to Karaf 3.x.
3.4.1. Migrating from Karaf 2.x to Karaf 3.x Link kopierenLink in die Zwischenablage kopiert!
The changes to Apache Karaf that must be considered before upgrading from versions 2.x to 3.x are:
- The files in the different Apache Karaf folders have changed, and the merge/diff is very large so it is advisable to start a new Apache Karaf 3.x container rather than overriding the folders from an Apache Karaf 2.x container.
-
The future Apache Karaf versions will introduce the concept of
Karaf Profilesto simplify the update process. -
WebApplications using the
WebApp-Contextheaders in theMANIFESTare no longer supported. -
Apache Karaf now supports the OSGi standard
Web-ContextPathheader in theMANIFEST. - Apache Karaf 3.0.x is fully supported by OPS4J Pax Exam.
3.4.2. Migrating from Karaf 3.x to Karaf 4.x Link kopierenLink in die Zwischenablage kopiert!
The changes to Karaf that must be considered before upgrading from Karaf 2.x to Karaf 3.x.
- Karaf 4.x supports Java8.
-
If you upgrade an existing Karaf container, make a note to update the
libandsystemfolders. For theetcfolder, a diff is required. - Karaf 4.x has a new Feature Resolver. The purpose is to simplify the features installation and lifecycle. The new resolver now checks the feature requirements defined in the features XML, and check which bundles provides the capabilities to satisfy these requirements. It allows Karaf to automatically install bundles required by features. This feature is not enabled in Karaf 3.x.
3.5. New Commands in Karaf 4.x Link kopierenLink in die Zwischenablage kopiert!
| Apache Karaf 4.x |
|---|
| feature:requirement-list |
| feature:requirement-add |
| feature:requirement-remove |
| feature:regions |
| feature:start |
| feature:stop |
| jaas:group-create |
| jaas:group-add |
| jaas:group-delete |
| jaas:group-list |
| jaas:group-role-add |
| jaas:group-role-delete |
| jaas:su |
| jaas:sudo |
| shell:edit |
| shell:env |
| shell:less |
| shell:stack-traces-print |
| shell:threads |
| shell:while |
| log:list |
| bundle:capabilities |
| bundle:diag |
| bundle:id |
| bundle:load-test |
| bundle:requirements |
| bundle:resolve |
| system:name |
- In development environment you can use the blueprint definition as used in Karaf 2.x and 3.x with the corresponding annotations.
-
In Karaf 4.x, you can use DS and new annotations and avoid the usage of a blueprint XML. The new annotations are:
@Service,@Completion,@Parsing,@Reference. You can define the command directly in the command class. -
Karaf 4.x provides the karaf-services-maven-plugin in
org.apache.karaf.toolingMaven groupId to simplify the generation of the code and OSGi headers.