com.jcraft.jsch.JSchException: проверка: невярно

Опитвам кода, даден на https://github.com/spring-projects/spring-integration-samples/tree/master/basic/sftp, и когато изпълнявам теста в Eclipse, той преминава, но когато го опитвам чрез maven (mvn чист компилиращ тест) става неуспешно с проследяване на стека по-долу

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

В Мейвън

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 открих разликата, както е показано по-долу В 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 - 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