I can reproduce the issue.
I think it might be a bug in the resolver.

What I found:
Camel commands import this package: (&(osgi.wiring.package=org.apache.karaf.shell.console)(version>=3.0.0)(!(version>=5.0.0)))

The exported packages show this:
org.apache.karaf.shell.console │ 2.3.0 │ 42 │ org.apache.karaf.shell.console org.apache.karaf.shell.console │ 4.1.0 │ 42 │ org.apache.karaf.shell.console

So the package is exported in two versions. The version 2.3.0 would not match the range camel imports, the 4.1.0 version would match it. I suspect that the resolver behaves differently depending on which version it checks first. If it checks the 4.1.0 first it works, if it checks the 2.1.0 version first it fails. I guess it should check both versions and take the working one but apparently it does not.

Unfortunately I do not know the implementation well enough to check or fix this but maybe it helps Guillaume to find the issue :-)

Christian

On 31.01.2017 21:42, Krzysztof Sobkowiak wrote:
Hi

While testing 4.1.0 I have observed following issue.

karaf@root()> feature:repo-add camel 2.18.2                                     
                                                                                   
      21:35:06
Adding feature url mvn:org.apache.camel.karaf/apache-camel/2.18.2/xml/features
karaf@root()> feature:install camel                                             
                                                                                   
      21:35:19
karaf@root()> camel                                                             
                                                                                   
      21:35:26
camel                       camel:context-list          camel:eip-explain       
    camel:rest-api-doc          camel:route-profile         camel:route-start
camel                       camel:context-resume        camel:eip-explain       
    camel:rest-registry-list    camel:route-profile         camel:route-stop
camel:component-list        camel:context-resume        camel:endpoint-explain  
    camel:rest-registry-list    camel:route-reset-stats     camel:route-stop
camel:component-list        camel:context-start         camel:endpoint-explain  
    camel:rest-show             camel:route-reset-stats     camel:route-suspend
camel:context-inflight      camel:context-start         camel:endpoint-list     
    camel:rest-show             camel:route-resume          camel:route-suspend
camel:context-inflight      camel:context-stop          camel:endpoint-list     
    camel:route-info            camel:route-resume
camel:context-info          camel:context-stop          camel:endpoint-stats    
    camel:route-info            camel:route-show
camel:context-info          camel:context-suspend       camel:endpoint-stats    
    camel:route-list            camel:route-show
camel:context-list          camel:context-suspend       camel:rest-api-doc      
    camel:route-list            camel:route-start

The commands are available and work. But after Karaf restart they are no more 
available and the log contains following error:

2017-01-31 21:37:25,415 | ERROR | FelixStartLevel  | Felix                            |  -  -  | Bundle 
org.apache.camel.karaf.camel-karaf-commands [57] Error starting 
mvn:org.apache.camel.karaf/camel-karaf-commands/2.18.2 (org.osgi.framework.BundleException: Unable to 
resolve org.apache.camel.karaf.camel-karaf-commands [57](R 57.0): missing requirement 
[org.apache.camel.karaf.camel-karaf-commands [57](R 57.0)] osgi.wiring.package; 
(&(osgi.wiring.package=org.apache.karaf.shell.console)(version>=3.0.0)(!(version>=5.0.0))) 
[caused by: Unable to resolve org.apache.karaf.shell.console [42](R 42.0): missing requirement 
[org.apache.karaf.shell.console [42](R 42.0)] osgi.wiring.host; 
(&(osgi.wiring.host=org.apache.karaf.shell.core)(bundle-version>=0.0.0))] Unresolved requirements: 
[[org.apache.camel.karaf.camel-karaf-commands [57](R 57.0)] osgi.wiring.package; 
(&(osgi.wiring.package=org.apache.karaf.shell.console)(version>=3.0.0)(!(version>=5.0.0)))])
org.osgi.framework.BundleException: Unable to resolve org.apache.camel.karaf.camel-karaf-commands [57](R 
57.0): missing requirement [org.apache.camel.karaf.camel-karaf-commands [57](R 57.0)] osgi.wiring.package; 
(&(osgi.wiring.package=org.apache.karaf.shell.console)(version>=3.0.0)(!(version>=5.0.0))) 
[caused by: Unable to resolve org.apache.karaf.shell.console [42](R 42.0): missing requirement 
[org.apache.karaf.shell.console [42](R 42.0)] osgi.wiring.host; 
(&(osgi.wiring.host=org.apache.karaf.shell.core)(bundle-version>=0.0.0))] Unresolved requirements: 
[[org.apache.camel.karaf.camel-karaf-commands [57](R 57.0)] osgi.wiring.package; 
(&(osgi.wiring.package=org.apache.karaf.shell.console)(version>=3.0.0)(!(version>=5.0.0)))]
     at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111) 
[?:?]
     at org.apache.felix.framework.Felix.startBundle(Felix.java:2117) [?:?]
     at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371) 
[?:?]
     at 
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
 [?:?]
     at java.lang.Thread.run(Thread.java:745) [?:?]
2017-01-31 21:37:25,417 | ERROR | lixDispatchQueue | camel-karaf-commands       
      | 57 - org.apache.camel.karaf.camel-karaf-commands - 2.18.2 | 
FrameworkEvent ERROR - org.apache.camel.karaf.camel-karaf-commands
org.osgi.framework.BundleException: Unable to resolve org.apache.camel.karaf.camel-karaf-commands [57](R 
57.0): missing requirement [org.apache.camel.karaf.camel-karaf-commands [57](R 57.0)] osgi.wiring.package; 
(&(osgi.wiring.package=org.apache.karaf.shell.console)(version>=3.0.0)(!(version>=5.0.0))) 
[caused by: Unable to resolve org.apache.karaf.shell.console [42](R 42.0): missing requirement 
[org.apache.karaf.shell.console [42](R 42.0)] osgi.wiring.host; 
(&(osgi.wiring.host=org.apache.karaf.shell.core)(bundle-version>=0.0.0))] Unresolved requirements: 
[[org.apache.camel.karaf.camel-karaf-commands [57](R 57.0)] osgi.wiring.package; 
(&(osgi.wiring.package=org.apache.karaf.shell.console)(version>=3.0.0)(!(version>=5.0.0)))]
     at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111) 
[?:?]
     at org.apache.felix.framework.Felix.startBundle(Felix.java:2117) [?:?]
     at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371) 
[?:?]
     at 
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
 [?:?]
     at java.lang.Thread.run(Thread.java:745) [?:?]


The same happens with other 3rd party commands, e.g:

karaf@root()> feature:repo-add activemq 5.15.0-SNAPSHOT                         
                                                                                   
            21:39:14
Adding feature url 
mvn:org.apache.activemq/activemq-karaf/5.15.0-SNAPSHOT/xml/features
karaf@root()> feature:install activemq-broker-noweb                             
                                                                                   
            21:39:26
karaf@root()> activemq                                                          
                                                                                   
            21:39:37
activemq             activemq:bstat       activemq:consumer    activemq:list    
    activemq:producer    activemq:query
activemq:browse      activemq:bstat       activemq:dstat       activemq:list    
    activemq:purge       activemq:query
activemq:browse      activemq:consumer    activemq:dstat       
activemq:producer    activemq:purge

Is this the same problem you have mentioned in this thread?

Kindly regards
Krzysztof



On 29.01.2017 13:38, Jean-Baptiste Onofré wrote:
2. Shell command issue
Several projects providing shell commands (like Camel, ActiveMQ, ...) directly use 
jline dependency. It's pretty bad (they should use the Karaf "wrapper), and, as 
Karaf 4.1.x now uses JLine 3.x, those commands don't work in Karaf 4.1.x.
Here, we have two solutions:
2.1. We create the jline "2.x" compliant packages in Karaf (in a bundle as part 
of the shell-compat feature for instance). It's only a workaround but should fix the 
issue.
2.2. jline 3.x can provide a "compat" bundle with the jline 2.x packages name, 
wrapping the jline 3.x ones. It's probably the most elegant solution, but it's require a 
new jline 3.x release.


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

Reply via email to