Mike at Savient
Mike at Savient

Reputation: 280

Karaf bundles not loaded from .kar on deploy

I have a Karaf application with three bundles in a .kar file, specified by a features.xml.

When I deploy the compiled .kar (using maven plug-in) on the target VM, the main bundle loads and updates in Karaf, but it appears that a dependent bundle (add-on capabilities), is not extracted and deployed - Karaf tries to get the bundle from the /system/ repository instead of the .kar.

Deployment works on my Dev machine, by I suspect the dependent bundle is being pulled from the local Maven repo which is up to date due to the build process.

Currently to work around this on the target machine I have to copy my local repo to the [karaf.root]/system/ folder in order for all bundles to get updated when the .kar is hot-deployed.

Does anyone know how to configure the features .xml so bundles are pulled out of the .kar instead of [initially] from the /system folder? My features.xml file is;

<features name="${project.artifactId}-${project.version}"
xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0">

<feature name="${project.artifactId}" install="auto" version="${project.version}"
    description="${project.description}">
    <bundle dependency="true">mvn:com.google.code.gson/gson/${gson.version}</bundle>
    <bundle>mvn:uk.co.company.product/product-common-api/${project.version}</bundle>
    <bundle>mvn:uk.co.company.product/product-core-services/${project.version}</bundle>
    <bundle>mvn:uk.co.company.product/product-scenario-exporter/${project.version}</bundle>

<feature prerequisite="true">camel-jetty</feature>
<feature prerequisite="true">webconsole</feature>
</feature>

I've checked and the required bundles (i.e. common-api) is included within the compiled kar file's repository folder.

Upvotes: 1

Views: 1135

Answers (1)

Christian Schneider
Christian Schneider

Reputation: 19626

You simply use a mvn url for the bundle you need. The content of the kar will be one source for such dependencies. I assume that you have an error in your kar. Can you post your kar file here (maybe slimmed down to neutral content)?

What is the file structure inside your kar? It should contains a directory repository and inside should be subdirectories and jars like in a maven repository. Only then will the mvn url be resolved.

Upvotes: 0

Related Questions