gpt4 book ai didi

java - com.jcraft.jsch.JSchException : verify: false 错误

转载 作者:行者123 更新时间:2023-11-30 11:00:36 26 4
gpt4 key购买 nike

我正在尝试 https://github.com/spring-projects/spring-integration-samples/tree/master/basic/sftp 给出的代码,当我在 Eclipse 中运行测试时,它通过了,但是当我通过 maven(mvn clean compile test)尝试它时,它失败了,堆栈跟踪如下

org.springframework.messaging.MessagingException: Failed to obtain pooled item; nested exception is java.lang.IllegalStateException: failed to create SFTP Session
at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:178)
at org.springframework.integration.file.remote.session.CachingSessionFactory.getSession(CachingSessionFactory.java:118)
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:332)
at org.springframework.integration.samples.sftp.SftpTestUtils.createTestFiles(SftpTestUtils.java:25)
at org.springframework.integration.samples.sftp.SftpInboundAdapterTest.assertFilePattern(SftpInboundAdapterTest.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: java.lang.IllegalStateException: failed to create SFTP Session
at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:355)
at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:49)
at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:76)
at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:73)
at org.springframework.integration.util.SimplePool.doGetItem(SimplePool.java:188)
at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:169)
... 29 more
Caused by: java.lang.IllegalStateException: failed to connect
at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:272)
at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:350)
... 34 more
Caused by: com.jcraft.jsch.JSchException: verify: false
at com.jcraft.jsch.Session.connect(Session.java:330)
at com.jcraft.jsch.Session.connect(Session.java:183)
at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:263)
... 35 more

无法理解哪里出了问题

在pom中刚刚添加了下面的插件

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
</configuration>
</plugin>

添加日志文件行
在 Eclipse 中

2015-07-17 19:15:33 jsch [INFO] expecting SSH_MSG_KEXDH_REPLY
2015-07-17 19:15:33 jsch [INFO] ssh_dss_verify: signature true

在 Maven 中

2015-07-17 19:13:26 jsch [INFO] expecting SSH_MSG_KEXDH_REPLY
2015-07-17 19:13:26 ServerSession [INFO] Kex: server->client aes128-ctr hmac-md5 none
2015-07-17 19:13:26 ServerSession [INFO] Kex: client->server aes128-ctr hmac-md5 none
2015-07-17 19:13:26 jsch [INFO] ssh_dss_verify: signature false

最佳答案

不幸的是,来自 jsch 的 verify: false 只是一个包罗万象的“出了点问题”。我建议您查看服务器日志。

此外,打开 debug logging for jsch并比较 eclipse 和 maven 之间的输出。

可能使用了不同的 key 文件?

关于java - com.jcraft.jsch.JSchException : verify: false 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31452065/

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