camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thibault, Daniel" <Daniel.Thiba...@drdc-rddc.gc.ca>
Subject Problem with ssh under camel 2.19.0
Date Thu, 13 Jul 2017 19:17:12 GMT
   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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message