2014-07-26 256 views
0

我有我的春季集成示例程序与我的Mac设置作为本地SFTP服务器(只是as here)一起工作正常。我尝试用实际的(我们的客户端/提供者的)SFTP证书替换我的测试证书,并且Spring Integration给我以下例外,在JSCH模块中。我实际上能够连接到此服务器并使用Filezilla浏览目录。SFTP集成JSCH - 无法执行会话

任何指针都会有很大的帮助。会话创建是非常常见的方法:

<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"> 
    <property name="host" value="${host}"/> 
    <property name="port" value="${port}"/> 
    <property name="user" value="${user}"/> 
    <property name="password" value="${password}"/> 
</bean> 

这里的日志:

19:48:08.511 [tomcat-http--13] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'chofac-tory' processing POST request for [/chofactory/launchAJob/fetchResponseFile] 
19:48:08.511 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Looking up handler method for path /launchAJob/fetchResponseFile 
19:48:08.511 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Returning handler method [public org.springframework.http.ResponseEntity<java.lang.String> com.chofac.mint.jobLaunchController.fetchResponseFile(java.lang.String,org.springframework.ui.Model) throws java.lang.Exception] 
19:48:08.511 [tomcat-http--13] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'jobLaunchController' 
19:48:08.512 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestResponseBodyMethodProcessor - Reading [java.lang.String] as "application/json;charset=UTF-8" using [[email protected]f8dfc4] 
19:48:14.233 [tomcat-http--13] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'integrationEvaluationContext' 
19:48:14.243 [tomcat-http--13] DEBUG o.s.i.channel.DirectChannel - preSend on channel 'inbound', message: [Payload String content=/outbox][Headers={errorChannel=org.springframewor[email protected]57107ed0, replyChannel=org.springframewor[email protected]57107ed0, id=4962a3a4-59e9-2596-e91d-331720b769c2, timestamp=1406342894242}] 
19:48:14.243 [tomcat-http--13] DEBUG o.s.i.s.gateway.SftpOutboundGateway - org.springframework.integration.sftp.gateway.SftpOutboundGateway#0 received message: [Payload String content=/outbox][Headers={errorChannel=org.springframewor[email protected]57107ed0, replyChannel=org.springframewor[email protected]57107ed0, id=4962a3a4-59e9-2596-e91d-331720b769c2, timestamp=1406342894242}] 
19:48:14.249 [tomcat-http--13] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'integrationEvaluationContext' 
19:48:14.255 [tomcat-http--13] INFO com.jcraft.jsch - Connecting to gatewaytest.somedomain.com port 22 
19:48:14.277 [tomcat-http--13] INFO com.jcraft.jsch - Connection established 
19:48:14.297 [tomcat-http--13] INFO com.jcraft.jsch - Remote version string: SSH-2.0-SSHD 
19:48:14.297 [tomcat-http--13] INFO com.jcraft.jsch - Local version string: SSH-2.0-JSCH-0.1.51 
19:48:14.297 [tomcat-http--13] INFO com.jcraft.jsch - CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256 
19:48:14.303 [tomcat-http--13] INFO com.jcraft.jsch - CheckKexes: diffie-hellman-group14-sha1 
19:48:14.304 [tomcat-http--13] INFO com.jcraft.jsch - diffie-hellman-group14-sha1 is not available. 
19:48:14.305 [tomcat-http--13] INFO com.jcraft.jsch - SSH_MSG_KEXINIT sent 
19:48:14.385 [tomcat-http--13] INFO com.jcraft.jsch - SSH_MSG_KEXINIT received 
19:48:14.385 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1 
19:48:14.385 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: ssh-rsa 
19:48:14.386 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: aes256-cbc,aes192-cbc,aes128-cbc,3des-cbc 
19:48:14.386 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: aes256-cbc,aes192-cbc,aes128-cbc,3des-cbc 
19:48:14.386 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: hmac-sha1,hmac-sha1-96 
19:48:14.386 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: hmac-sha1,hmac-sha1-96 
19:48:14.386 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: none,zlib 
19:48:14.387 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: none,zlib 
19:48:14.387 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: 
19:48:14.387 [tomcat-http--13] INFO com.jcraft.jsch - kex: server: 
19:48:14.387 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1 
19:48:14.387 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: ssh-rsa,ssh-dss 
19:48:14.388 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc 
19:48:14.388 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc 
19:48:14.388 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 
19:48:14.388 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 
19:48:14.388 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: none 
19:48:14.389 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: none 
19:48:14.389 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: 
19:48:14.389 [tomcat-http--13] INFO com.jcraft.jsch - kex: client: 
19:48:14.390 [tomcat-http--13] INFO com.jcraft.jsch - kex: server->client aes128-cbc hmac-sha1 none 
19:48:14.391 [tomcat-http--13] INFO com.jcraft.jsch - kex: client->server aes128-cbc hmac-sha1 none 
19:48:14.477 [tomcat-http--13] INFO com.jcraft.jsch - SSH_MSG_KEXDH_INIT sent 
19:48:14.477 [tomcat-http--13] INFO com.jcraft.jsch - expecting SSH_MSG_KEXDH_REPLY 
19:48:14.624 [tomcat-http--13] INFO com.jcraft.jsch - ssh_rsa_verify: signature true 
19:48:14.625 [tomcat-http--13] INFO com.jcraft.jsch - Host 'fsgatewaytest.aexp.com' is known and mathces the RSA host key 
19:48:14.625 [tomcat-http--13] INFO com.jcraft.jsch - SSH_MSG_NEWKEYS sent 
19:48:14.625 [tomcat-http--13] INFO com.jcraft.jsch - SSH_MSG_NEWKEYS received 
19:48:14.628 [tomcat-http--13] INFO com.jcraft.jsch - SSH_MSG_SERVICE_REQUEST sent 
19:48:14.684 [tomcat-http--13] INFO com.jcraft.jsch - SSH_MSG_SERVICE_ACCEPT received 
19:48:14.704 [tomcat-http--13] INFO com.jcraft.jsch - Authentications that can continue: publickey,keyboard-interactive,password 
19:48:14.704 [tomcat-http--13] INFO com.jcraft.jsch - Next authentication method: publickey 
19:48:14.705 [tomcat-http--13] INFO com.jcraft.jsch - Authentications that can continue: keyboard-interactive,password 
19:48:14.705 [tomcat-http--13] INFO com.jcraft.jsch - Next authentication method: keyboard-interactive 
19:48:14.848 [tomcat-http--13] INFO com.jcraft.jsch - Authentications that can continue: password 
19:48:14.848 [tomcat-http--13] INFO com.jcraft.jsch - Next authentication method: password 
19:48:14.871 [tomcat-http--13] INFO com.jcraft.jsch - Disconnecting from fsgatewaytest.aexp.com port 22 
19:48:14.883 [tomcat-http--13] WARN o.s.i.g.GatewayProxyFactoryBean$MethodInvocationGateway - failure occurred in gateway sendAndReceive 
org.springframework.messaging.MessagingException: org.springframework.messaging.MessagingException: Failed to execute on session 
    at org.springframework.integration.dispatcher.AbstractDispatcher.wrapExceptionIfNecessary(AbstractDispatcher.java:133) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:120) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:101) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:255) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:223) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:114) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE] 
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:154) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE] 
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:44) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE] 
    at org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive(AbstractMessagingTemplate.java:75) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE] 
    at org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive(AbstractMessagingTemplate.java:132) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE] 
    at org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive(AbstractMessagingTemplate.java:110) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE] 
    at org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:241) [spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceive(MessagingGatewaySupport.java:220) [spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:341) [spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:304) [spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:295) [spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) [spring-aop-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at com.sun.proxy.$Proxy137.lsGetAndRmFiles(Unknown Source) [na:na] 
    at com.chofac.mint.jobLaunchController.fetchResponseFile(jobLaunchController.java:202) [jobLaunchController.class:na] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_65] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_65] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_65] 
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_65] 
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) [spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:748) [spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) [spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) [spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) [spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) [spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931) [spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:833) [spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) [servlet-api.jar:na] 
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) [spring-webmvc-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) [servlet-api.jar:na] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.50.C] 
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:177) [spring-orm-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.50.C] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173) [spring-security-web-3.1.0.RELEASE.jar:3.1.0.RELEASE] 
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.50.C] 
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.50.C] 
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) [spring-web-4.0.0.RELEASE.jar:4.0.0.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.50.C] 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409) [catalina.jar:7.0.50.C] 
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044) [tomcat-coyote.jar:7.0.50.C] 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) [tomcat-coyote.jar:7.0.50.C] 
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313) [tomcat-coyote.jar:7.0.50.C] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [na:1.6.0_65] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [na:1.6.0_65] 
    at java.lang.Thread.run(Thread.java:695) [na:1.6.0_65] 
Caused by: org.springframework.messaging.MessagingException: Failed to execute on session 
    at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:311) ~[spring-integration-file-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doLs(AbstractRemoteFileOutboundGateway.java:402) ~[spring-integration-file-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.handleRequestMessage(AbstractRemoteFileOutboundGateway.java:378) ~[spring-integration-file-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:170) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116) ~[spring-integration-core-4.0.0.RELEASE.jar:na] 
    ... 92 common frames omitted 
Caused by: java.lang.IllegalStateException: failed to create SFTP Session 
    at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:354) ~[spring-integration-sftp-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:300) ~[spring-integration-file-4.0.0.RELEASE.jar:na] 
    ... 97 common frames omitted 
Caused by: java.lang.IllegalStateException: failed to connect 
    at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:250) ~[spring-integration-sftp-4.0.0.RELEASE.jar:na] 
    at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:349) ~[spring-integration-sftp-4.0.0.RELEASE.jar:na] 
    ... 98 common frames omitted 
Caused by: com.jcraft.jsch.JSchException: SSH_MSG_DISCONNECT: 11 Too many bad authentication attempts! 
    at com.jcraft.jsch.Session.read(Session.java:987) ~[jsch-0.1.51.jar:na] 
    at com.jcraft.jsch.UserAuthPassword.start(UserAuthPassword.java:91) ~[jsch-0.1.51.jar:na] 
    at com.jcraft.jsch.Session.connect(Session.java:463) ~[jsch-0.1.51.jar:na] 
    at com.jcraft.jsch.Session.connect(Session.java:183) ~[jsch-0.1.51.jar:na] 
    at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:241) ~[spring-integration-sftp-4.0.0.RELEASE.jar:na] 
    ... 99 common frames omitted 
+0

你真的有'<背景:物业占位符>'配置? –

+0

显然是一个身份验证问题。 '引起:com.jcraft.jsch.JSchException:SSH_MSG_DISCONNECT:11认证尝试失败!' –

+0

是的我有 oneworld

回答

2

我不知道该怎么告诉你;你是肯定的凭据是正确的?它必须是简单的。

如果我使用...

<bean id="sftpSessionFactory" 
    class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"> 
    <property name="host" value="myserver"/> 
    <property name="port" value="22"/> 
    <property name="user" value="ftptest"/> 
    <property name="password" value="ftptest"/> 
</bean> 

我没有问题。

如果我将其更改为...

<bean id="sftpSessionFactory" 
    class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"> 
    <property name="host" value="myserver"/> 
    <property name="port" value="22"/> 
    <property name="user" value="ftptest"/> 
    <property name="password" value="junk"/> 
</bean> 

...我得到完全相同的结果你。

Caused by: com.jcraft.jsch.JSchException: SSH_MSG_DISCONNECT: 2 Too many authentication failures for ftptest 

在服务器(tail -f /var/log/auth.log)我看到6次尝试与错误的密码进行连接。

您应该考虑使用公钥/私钥 - 反正它更安全。

编辑:

您可以防止在回退,并通过添加配置属性只有通过密码验证尝试...

<util:properties id="props"> 
    <prop key="PreferredAuthentications">password</prop> 
</util:properties> 

<bean id="sftpSessionFactory" 
    class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"> 
    <property name="host" value="10.0.0.3"/> 
    <property name="port" value="22"/> 
    <property name="user" value="ftpTest"/> 
    <property name="password" value="ftpTest"/> 
    <property name="sessionConfig" ref="props" /> 
</bean> 
+0

感谢Gary&Artem Bilan,我的问题与此[post]类似(http://stackoverflow.com/questions/16154361/spring-integration-jsch-auth-fail)。经过几次尝试后,远程SFTP服务器会被锁定,我必须等待2-3小时才能再次尝试。这个问题有点模糊,因为Filezilla连接,但不是程序。该计划现在正常运作。 – oneworld

+0

这可能是因为后备;我编辑了我的答案,以显示如何避免尝试其他机制。 –

+0

当然,谢谢。让我将其修改为我的代码。 – oneworld