com.jcraft.jsch.SftpException:
报错日志:
com.jcraft.jsch.SftpException: at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1647) at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1553) at com.hare.tree.utils.SftpUtil.listFile(SftpUtil.java:343) at com.hare.tree.utils.SftpUtil.download(SftpUtil.java:221) at com.hare.tree.service.impl.LoanServiceImpl.downloadAndStore(LoanServiceImpl.java:428) at com.hare.tree.service.impl.LoanServiceImpl.download(LoanServiceImpl.java:192) at com.hare.tree.service.impl.LoanServiceImpl$$FastClassBySpringCGLIB$$43f0c1eb.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:367) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) at org.apache.skywalking.apm.plugin.spring.async.SWCallable.call(SWCallable.java:47) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
背景:
同时多次调用连接三方的sftp文件服务器,但是调用的工具类是单线程的,所有异步调用时报错,
解决方案:
调用时,用单线程去调用,让后面的请求阻塞到那里
附:
也会是其他问题:
1.你电脑的IP没有在对方的白名单类,所以一直请求不通导致报错
2.或者是你已经在白名单类,但是你的密码错误,也会报错