2013-04-22 3 views
2

내가 봄 통합의 SFTP 인바운드 채널 어댑터를 사용하는 것을 시도하고 실패,하지만 난 여기 갇혀있어 :봄 통합/JSch : 인증은

20:29:30,458 INFO [com.jcraft.jsch] (task-scheduler-6) Connecting to deployment port 22 
20:29:30,484 INFO [com.jcraft.jsch] (task-scheduler-6) Connection established 
20:29:30,514 INFO [com.jcraft.jsch] (task-scheduler-6) Remote version string: SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1 
20:29:30,514 INFO [com.jcraft.jsch] (task-scheduler-6) Local version string: SSH-2.0-JSCH-0.1.45 
20:29:30,514 INFO [com.jcraft.jsch] (task-scheduler-6) CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256 
20:29:30,515 INFO [com.jcraft.jsch] (task-scheduler-6) CheckKexes: diffie-hellman-group14-sha1 
20:29:30,515 INFO [com.jcraft.jsch] (task-scheduler-6) diffie-hellman-group14-sha1 is not available. 
20:29:30,516 INFO [com.jcraft.jsch] (task-scheduler-6) SSH_MSG_KEXINIT sent 
20:29:30,537 INFO [com.jcraft.jsch] (task-scheduler-6) SSH_MSG_KEXINIT received 
20:29:30,538 INFO [com.jcraft.jsch] (task-scheduler-6) kex: server->client aes128-ctr hmac-md5 none 
20:29:30,538 INFO [com.jcraft.jsch] (task-scheduler-6) kex: client->server aes128-ctr hmac-md5 none 
20:29:30,540 INFO [com.jcraft.jsch] (task-scheduler-6) SSH_MSG_KEXDH_INIT sent 
20:29:30,540 INFO [com.jcraft.jsch] (task-scheduler-6) expecting SSH_MSG_KEXDH_REPLY 
20:29:30,572 INFO [com.jcraft.jsch] (task-scheduler-6) ssh_rsa_verify: signature true 
20:29:30,572 INFO [com.jcraft.jsch] (task-scheduler-6) Host 'deployment' is known and mathces the RSA host key 
20:29:30,573 INFO [com.jcraft.jsch] (task-scheduler-6) SSH_MSG_NEWKEYS sent 
20:29:30,573 INFO [com.jcraft.jsch] (task-scheduler-6) SSH_MSG_NEWKEYS received 
20:29:30,573 INFO [com.jcraft.jsch] (task-scheduler-6) SSH_MSG_SERVICE_REQUEST sent 
20:29:30,597 INFO [com.jcraft.jsch] (task-scheduler-6) SSH_MSG_SERVICE_ACCEPT received 
20:29:30,650 INFO [com.jcraft.jsch] (task-scheduler-6) Authentications that can continue: publickey,keyboard-interactive,password 
20:29:30,651 INFO [com.jcraft.jsch] (task-scheduler-6) Next authentication method: publickey 
20:29:30,678 INFO [com.jcraft.jsch] (task-scheduler-6) Authentications that can continue: password 
20:29:30,679 INFO [com.jcraft.jsch] (task-scheduler-6) Next authentication method: password 
20:29:30,679 INFO [com.jcraft.jsch] (task-scheduler-6) Disconnecting from deployment port 22 
20:29:30,679 DEBUG [org.springframework.integration.channel.PublishSubscribeChannel] (task-scheduler-6) preSend on channel 'errorChannel', message: [Payload=org.springframework.integration.MessagingException: Failed to obtain pooled item][Headers={timestamp=1366655370679, id=c6f7922d-d121-4f7e-b60c-5e1905960f5e}] 
20:29:30,680 DEBUG [org.springframework.integration.handler.LoggingHandler] (task-scheduler-6) (inner bean)#24 received message: [Payload=org.springframework.integration.MessagingException: Failed to obtain pooled item][Headers={timestamp=1366655370679, id=c6f7922d-d121-4f7e-b60c-5e1905960f5e}] 
20:29:30,681 ERROR [org.springframework.integration.handler.LoggingHandler] (task-scheduler-6) org.springframework.integration.MessagingException: Failed to obtain pooled item 
    at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:170) 
    at org.springframework.integration.file.remote.session.CachingSessionFactory.getSession(CachingSessionFactory.java:83) 
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:143) 
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.receive(AbstractInboundFileSynchronizingMessageSource.java:146) 
    at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:111) 
    at org.springframework.integration.endpoint.AbstractTransactionSynchronizingPollingEndpoint.doPoll(AbstractTransactionSynchronizingPollingEndpoint.java:67) 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146) 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:144) 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:236) 
    at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) 
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) 
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49) 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:231) 
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) 
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) 
    at java.lang.Thread.run(Thread.java:680) 
Caused by: java.lang.IllegalStateException: failed to create SFTP Session 
    at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:266) 
    at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:55) 
    at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:53) 
    at org.springframework.integration.util.SimplePool.doGetItem(SimplePool.java:180) 
    at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:160) 
    ... 22 more 
Caused by: java.lang.IllegalStateException: failed to connect 
    at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:204) 
    at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:262) 
    ... 26 more 
Caused by: com.jcraft.jsch.JSchException: Auth cancel 
    at com.jcraft.jsch.Session.connect(Session.java:463) 
    at com.jcraft.jsch.Session.connect(Session.java:158) 
    at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:196) 
    ... 27 more 

나는 개인 키는 내가 할 수 있기 때문에 정확하다는 것을 절대적으로 확신 이 작업을 수행 :

$ sftp [email protected] 
Connected to deployment. 
sftp> quit 

그리고 난에 ... 경로 ~/스푸핑/id_rsa_gsg_keypair를 .../SRC/메인/자원/키/sftp_rsa을 복사했다.

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:int="http://www.springframework.org/schema/integration" 
     xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp" 
     xmlns:context="http://www.springframework.org/schema/context" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd 

     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
     http://www.springframework.org/schema/integration/sftp http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd"> 

    <context:property-placeholder location="classpath:sftp.properties" ignore-resource-not-found="false" 
            ignore-unresolvable="true"/> 

    <bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"> 
     <property name="host" value="${sftp.host}"/> 
     <property name="port" value="${sftp.port}"/> 
     <property name="user" value="${sftp.username}"/> 
     <property name="privateKey" value="${sftp.private_key_file}"/> 
     <property name="privateKeyPassphrase" value="${sftp.private_key_passphrase}"/> 
    </bean> 

    <int-sftp:inbound-channel-adapter id="sftpInboundChannelAdapter" 
             channel="receiveChannel" 
             session-factory="sftpSessionFactory" 
             local-directory="file:local-dir" 
             remote-directory="${sftp.remote_directory}" 
             auto-create-local-directory="true" 
             delete-remote-files="false" 
             filename-regex=".*"> 
     <int:poller fixed-rate="5000" max-messages-per-poll="1"/> 
    </int-sftp:inbound-channel-adapter> 

    <int:channel id="receiveChannel"> 
     <int:queue/> 
    </int:channel> 

</beans> 

내 sftp.properties

은 다음과 같습니다 : 나는 a similar entry을 보았다

sftp.host=deployment 
sftp.username=web 
sftp.private_key_file=classpath:keys/sftp_rsa 
sftp.private_key_passphrase=<censored> 
sftp.remote_directory=/censored/path 
sftp.port=22 

하지만 자바 1.6이 아닌 1.4을 사용하고 있기 때문에이 도움이되지 않았다

내 구성입니다 .

힌트가 있습니까?

당신이 인용 다른 질문에서 설명하고있는 바와 같이

답변

2

, 흡연 총이 ...

20:29:30,650 INFO [com.jcraft.jsch] (task-scheduler-6) Authentications that can continue: publickey,keyboard-interactive,password 
20:29:30,651 INFO [com.jcraft.jsch] (task-scheduler-6) Next authentication method: publickey 
20:29:30,678 INFO [com.jcraft.jsch] (task-scheduler-6) Authentications that can continue: password 

약동학 인증이 실패입니다; 성공할 때 내가 그냥 GitHub의에서 샘플 키 파일로 sftp sample을 실행하고 당신이했던 동일한 결과를 얻었다

INFO: SSH_MSG_SERVICE_ACCEPT receivedINFO: Authentications that can continue: publickey,keyboard-interactive,password 
INFO: Next authentication method: publickey 
INFO: Authentication succeeded (publickey). 

... 다시 PW에 해당하지 않는다; 그런 다음 id_rsa 파일을 복사하여 (당신처럼) 잘 작동합니다. 이클립스를 사용하고 있다면 키 파일을 복사 한 후 src/main/resources을 F5 (새로 고침)해야합니다. 그렇지 않으면 현재 파일 시스템의 파일을 사용하지 않습니다.

+0

파일 변경을 감지하는 데 능숙한 IntelliJ를 사용하고 있습니다. 그럼에도 불구하고 프로젝트를 완료하고 다시 작성했지만 문제는 여전히 남아 있습니다. :/ –

+0

확실히 키 파일에 문제가있는 것 같습니다. 'sftp -o IdentityFile = path/to/id_rsa web @ deployment'를 시도해보십시오. –

+0

'sftp -o IdentityFile = sftp_rsa web @ deployment' 작동합니다. 즉 키가 괜찮습니다. –