Search code examples
apache-karafkaraf-maven-plugin

org.springframework cannot resolve in karaf


some below error is showing afterthe jar was deploy in karaf and this bundle was not able to start.

Exported Packages   org.apache.karaf.examples.command,version=1.0.0
Imported Packages   org.apache.karaf.examples.command.api,version=[1.0,2) from org.custom.command.custom-command-api (103)
org.osgi.framework,version=[1.8,2) from org.apache.felix.framework (0)
org.slf4j,version=[1.7,2) from org.ops4j.pax.logging.pax-logging-api (6)
**org.springframework.http -- Cannot be resolved
org.springframework.util -- Cannot be resolved
org.springframework.web.client -- Cannot be resolved**

The required dependency was added for spring-web. Refer below snippet

<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.1.9.RELEASE</version>
        </dependency>

from the error i can see most of the time it is failing at imported package while i dont have anything to specify in imported-package tag.

<Import-Package>
                            *
                        </Import-Package>

any help is truly appreciated !


Solution

  • Karaf won't have Spring libs unless you install them as a feature.

    Login to your karaf, and try:

    features:install spring-web