camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Problem with ssh under camel 2.19.0
Date Sun, 16 Jul 2017 07:16:09 GMT
Hi

You should use the versions of the JARs that Apache Camel is built with.

When you use Maven you get this "for free" here is what camel-ssh has
a dependency:tree


[INFO] org.apache.camel:camel-ssh:jar:2.20.0-SNAPSHOT
[INFO] +- org.apache.camel:camel-core:jar:2.20.0-SNAPSHOT:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.22:compile
[INFO] +- org.apache.mina:mina-core:jar:2.0.16:compile
[INFO] +- org.apache.sshd:sshd-core:jar:0.14.0:compile
[INFO] +- org.bouncycastle:bcpg-jdk15on:jar:1.55:compile
[INFO] |  \- org.bouncycastle:bcprov-jdk15on:jar:1.55:compile
[INFO] +- org.bouncycastle:bcpkix-jdk15on:jar:1.55:compile
[INFO] +- org.apache.camel:camel-test:jar:2.20.0-SNAPSHOT:test
[INFO] |  \- junit:junit:jar:4.12:test
[INFO] |     \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.8.2:test
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.8.2:test
[INFO] +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.8.2:test
[INFO] +- org.apache.camel:apt:jar:2.20.0-SNAPSHOT:provided
[INFO] |  \- org.apache.camel:spi-annotations:jar:2.20.0-SNAPSHOT:provided
[INFO] +- com.sun.xml.bind:jaxb-core:jar:2.2.11:compile
[INFO] \- com.sun.xml.bind:jaxb-impl:jar:2.2.11:compile

On Thu, Jul 13, 2017 at 9:17 PM, Thibault, Daniel
<Daniel.Thibault@drdc-rddc.gc.ca> wrote:
>    I'm a raw beginner with Camel.
>
>    I'm trying to work out an ssh query-response route using Camel. The java 8 code is
very simply this:
>
> package ...;
>
> import org.apache.camel.CamelContext;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.impl.DefaultCamelContext;
>
> public class CamelSshTest
> {
>     public static void main(String[] args) throws Exception
>     {
>         CamelContext context = new DefaultCamelContext();
>         context.addRoutes(new RouteBuilder() {
>             public void configure() {
>                 from("file:///.../commands?noop=true")
>                     .to("ssh://user@host:22?certResource=file:///.../.ssh/id_rsa")
>                     .to("file:///.../sshtest");
>             }
>         });
>         context.start();
>         Thread.sleep(10000);
>         context.stop();
>     }
> }
>
>    The source directory holds one-liner files that contain simple shell commands such
as 'uptime'. The target system trusts my id_rsa key.
>
>    When I invoke this, I made sure to have the following jars in the class path:
>
> camel-core-2.19.1.jar
> camel-ssh-2.19.1.jar
> slf4j-api-1.7.25.jar
> slf4j-simple-1.7.25.jar
> sshd-core-1.6.0.jar
>
>    (The slf4j jars are there to satisfy camel's hankering for StaticLoggerBinder)
>
>    This yields this output:
>
> [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.19.1 (CamelContext:
camel-1) is starting
> [main] INFO org.apache.camel.management.ManagedManagementStrategy - JMX is enabled
> [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 192 type converters
> [main] INFO org.apache.camel.impl.DefaultRuntimeEndpointRegistry - Runtime endpoint registry
is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache
limit: 1000)
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/sshd/common/KeyPairProvider
>         at java.lang.Class.getDeclaredMethods0(Native Method)
>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>         at java.lang.Class.getDeclaredMethods(Class.java:1975)
>         at org.apache.camel.util.ReflectionHelper.doWithMethods(ReflectionHelper.java:96)
>         at org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectMethods(DefaultCamelBeanPostProcessor.java:216)
>         at org.apache.camel.impl.DefaultCamelBeanPostProcessor.postProcessBeforeInitialization(DefaultCamelBeanPostProcessor.java:83)
>         at org.apache.camel.impl.DefaultInjector.newInstance(DefaultInjector.java:48)
>         at org.apache.camel.impl.DefaultComponentResolver.resolveComponent(DefaultComponentResolver.java:73)
>         at org.apache.camel.impl.DefaultCamelContext.initComponent(DefaultCamelContext.java:497)
>         at org.apache.camel.impl.DefaultCamelContext.lambda$getComponent$0(DefaultCamelContext.java:448)
>         at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
>         at org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:448)
>         at org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:432)
>         at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:666)
>         at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:80)
>         at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:219)
>         at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:112)
>         at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:118)
>         at org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:62)
>         at org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:56)
>         at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:549)
>         at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:510)
>         at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:226)
>         at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1295)
>         at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:204)
>         at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1087)
>         at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3544)
>         at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3275)
>         at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:202)
>         at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3093)
>         at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3089)
>         at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3112)
>         at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3089)
>         at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
>         at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3026)
>         at ca.gc.drdc_rddc.linux.utilinux.camel.CamelSshTest.main(CamelSshTest.java:34)
> Caused by: java.lang.ClassNotFoundException: org.apache.sshd.common.KeyPairProvider
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>         ... 36 more
>
>    Why is Camel looking for org.apache.sshd.common.KeyPairProvider? This used to exist
in sshd-core until 0.14.0, but the KeyPairProvider class moved to org.apache.sshd.common.keyprovider.KeyPairProvider
with version 1.0.0 and is still there in the current version, 1.6.0.
>
> Daniel U. Thibault, M.Sc.²
>
> Informaticien scientifique, CME-PSC, Centre de recherches de Valcartier
> Recherche et développement pour la défense Canada / Gouvernement du Canada
> daniel.thibault@drdc-rddc.gc.ca<mailto:daniel.thibault@drdc-rddc.gc.ca> / Tél:
418-844-4000x4245 Téléc: 418-844-4538
> daniel.thibault@forces.gc.ca<mailto:daniel.thibault@forces.gc.ca> / Tél: 418-844-4000x4245
Téléc: 418-844-4538
>
> Computer Scientist, MCCS-SPC, Valcartier Research Centre
> Defence Research and Development Canada / Government of Canada
> daniel.thibault@drdc-rddc.gc.ca<mailto:daniel.thibault@drdc-rddc.gc.ca> / Tel:
418-844-4000x4245 Fax: 418-844-4538
> daniel.thibault@forces.gc.ca<mailto:daniel.thibault@forces.gc.ca> / Tel: 418-844-4000x4245
Fax: 418-844-4538
>
> DRDC is an agency of the Department of National Defence / RDDC est une agence du ministère
de la Défense nationale
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message