[ 
https://issues.apache.org/jira/browse/CAMEL-6266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13862746#comment-13862746
 ] 

Keshav Baweja edited comment on CAMEL-6266 at 1/6/14 3:42 AM:
--------------------------------------------------------------

Hi, I have a query on this.

 com.jcraft.jsch.Proxy is an interface, I can't create a bean in spring 
configuration file with an Interface.
I tried with the below
        <bean id="proxy" class="com.jcraft.jsch.ProxySOCKS5">
                <constructor-arg index="0" value="ProxyServer" />               
<constructor-arg index="1" value="ProxyServerPort" />
        </bean>
ProxyServer is replaced with actual server in the file
ProxyServerPortis replaced with actual port in the file

Route Definition
                
from("sftp://username@server/directory?knownHostsFile=known_hosts&privateKeyFile=id_sa&proxy=proxy";)
                                .to("file:download/").log(
                                                "Downloaded file ${file:name} 
complete.");

I encounter the exception below
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve 
endpoint: 
sftp://username@server/directory?knownHostsFile=known_hosts&privateKeyFile=id_sa&proxy=proxy
 due to: Could not find a suitable setter for property: proxy as there isn't a 
setter method with same type: java.lang.String nor type conversion possible: No 
type converter available to convert from type: java.lang.String to the required 
type: com.jcraft.jsch.Proxy with value proxy
        at 
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:528)
        at 
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:63)
        at 
org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:192)
        at 
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:106)
        at 
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:112)
        at 
org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
        at 
org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)
        at 
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:890)
        at 
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:177)

Could you please suggest how to resolve this?




was (Author: keshavbaweja):
Hi, I have a couple of queries on this.

 com.jcraft.jsch.Proxy is an interface, I can't create a bean in spring 
configuration file with an Interface.
I tried with the below
        <bean id="proxy" class="com.jcraft.jsch.ProxySOCKS5">
                <constructor-arg index="0" value="ProxyServer" />
                <constructor-arg index="1" value="ProxyServerPort" />
        </bean>

Route Definition
                
from("sftp://username@server/directory?knownHostsFile=known_hosts&privateKeyFile=id_sa&proxy=proxy";)
                                .to("file:download/").log(
                                                "Downloaded file ${file:name} 
complete.");

I encounter the exception below
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve 
endpoint: 
sftp://username@server/directory?knownHostsFile=known_hosts&privateKeyFile=id_sa&proxy=proxy
 due to: Could not find a suitable setter for property: proxy as there isn't a 
setter method with same type: java.lang.String nor type conversion possible: No 
type converter available to convert from type: java.lang.String to the required 
type: com.jcraft.jsch.Proxy with value proxy
        at 
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:528)
        at 
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:63)
        at 
org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:192)
        at 
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:106)
        at 
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:112)
        at 
org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
        at 
org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)
        at 
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:890)
        at 
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:177)

Could you please suggest how to resolve this?



> Support for SFTP through a proxy
> --------------------------------
>
>                 Key: CAMEL-6266
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6266
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-ftp
>            Reporter: Joakim Ek
>            Assignee: Christian Müller
>            Priority: Minor
>             Fix For: 2.11.1, 2.12.0
>
>         Attachments: sftp_proxy.patch
>
>
> FTP and FTPS have the 'ftpClient' option that allows the use of a custom 
> org.apache.commons.net.ftp.FTPClient instance. I.e. 
> org.apache.commons.net.ftp.FTPHTTPClient to access a FTP server through a 
> HTTP proxy.
> SFTP currently lacks proxy support in Camel. The used JSch library however 
> has support for proxies.
> This patch adds a SFTP only option 'proxy' which allows passing in an 
> instance of com.jcraft.jsch.Proxy to JSch. This enables the use of SFTP 
> through HTTP, SOCKS4 and SOCKS5 proxies.
> Included are two new basic unit tests using [Little 
> Proxy|http://www.littleshoot.org/littleproxy/] to verify consuming and 
> producing through a HTTP proxy.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to