gpt4 book ai didi

java - SFTP 集成 JSCH - 无法在 session 上执行

转载 作者:行者123 更新时间:2023-12-02 05:35:59 27 4
gpt4 key购买 nike

我的 Spring Integration 示例程序与我的 Mac 设置一起作为本地 SFTP 服务器(只是 as here ),一切正常。我尝试用实际(我们的客户端/提供商)SFTP 凭据替换我的测试凭据,Spring Integration 在 JSCH 模块中给了我以下异常。我实际上能够连接到该服务器并使用 Filezilla 浏览目录。

任何指示都会有很大帮助。 session 创建几乎是常见的方式:

<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 [org.springframework.http.converter.StringHttpMessageConverter@73f8dfc4]
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.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@57107ed0, replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@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.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@57107ed0, replyChannel=org.springframework.messaging.core.GenericMessagingTemplate$TemporaryReplyChannel@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

最佳答案

我不知道该告诉你什么;您确定凭据正确吗?它必须是简单的事情。

如果我使用...

<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>

关于java - SFTP 集成 JSCH - 无法在 session 上执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24967080/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com