com.jcraft.jsch.JSchException: проверить: ложь

Я пробую код, указанный на 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

Не могу понять, что не так

В пом только что добавил плагин ниже

<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

В Мавене

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

person Hemant Kumar Bothra    schedule 16.07.2015    source источник


Ответы (2)


К сожалению, verify: false от jsch - это всего лишь уловка "что-то пошло не так". Я предлагаю вам посмотреть логи сервера.

Кроме того, включите ведение журнала отладки для jsch и сравните вывод между eclipse и maven.

Возможно, используется другой ключевой файл?

person Gary Russell    schedule 16.07.2015
comment
Привет @Gary Russell В Eclipse и Maven я обнаружил разницу, как показано ниже. In 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 In 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 - person Hemant Kumar Bothra; 17.07.2015
comment
Комментарии не годятся для кода/журналов, они плохо отображаются - они практически нечитаемы - вместо этого отредактируйте свой вопрос. - person Gary Russell; 17.07.2015
comment
Привет @Gary Russell,‹br /› Я обновил вопрос, как вы и просили. - person Hemant Kumar Bothra; 17.07.2015

Мне пришлось исключить следующий артефакт из другой зависимости:

<exclusions>
    <exclusion>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-crypto-cms</artifactId>
    </exclusion>
</exclusions>
person user1961312    schedule 13.04.2021