2

SFTP アウトバウンド ゲートウェイを実装しようとしていますが、次の例外が発生します。ファイルをローカル ディレクトリにダウンロードした後、ある場所から別の場所にファイルを移動したいと考えています。私はこの分野では新しいです。誰か助けてください。前もって感謝します。

例外トレース ログ:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.sftp.gateway.SftpOutboundGateway#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.integration.sftp.gateway.SftpOutboundGateway]: Constructor threw exception; nested exception is org.springframework.expression.spel.SpelParseException: EL1070E:(pos 0): Problem parsing left operand
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:278)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1114)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1017)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at com.canaldigital.tsi.bank.config.AppMain.main(AppMain.java:32)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.integration.sftp.gateway.SftpOutboundGateway]: Constructor threw exception; nested exception is org.springframework.expression.spel.SpelParseException: EL1070E:(pos 0): Problem parsing left operand
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:125)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:270)
    ... 14 more
Caused by: org.springframework.expression.spel.SpelParseException: EL1070E:(pos 0): Problem parsing left operand
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.raiseInternalException(InternalSpelExpressionParser.java:898)
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.checkLeftOperand(InternalSpelExpressionParser.java:916)
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.checkOperands(InternalSpelExpressionParser.java:910)
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.eatProductExpression(InternalSpelExpressionParser.java:234)
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.eatSumExpression(InternalSpelExpressionParser.java:213)
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.eatRelationalExpression(InternalSpelExpressionParser.java:168)
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.eatLogicalAndExpression(InternalSpelExpressionParser.java:156)
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.eatLogicalOrExpression(InternalSpelExpressionParser.java:144)
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.eatExpression(InternalSpelExpressionParser.java:104)
    at org.springframework.expression.spel.standard.InternalSpelExpressionParser.doParseExpression(InternalSpelExpressionParser.java:85)
    at org.springframework.expression.spel.standard.SpelExpressionParser.doParseExpression(SpelExpressionParser.java:56)
    at org.springframework.expression.spel.standard.SpelExpressionParser.doParseExpression(SpelExpressionParser.java:32)
    at org.springframework.expression.common.TemplateAwareExpressionParser.parseExpression(TemplateAwareExpressionParser.java:76)
    at org.springframework.expression.common.TemplateAwareExpressionParser.parseExpression(TemplateAwareExpressionParser.java:62)
    at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.<init>(AbstractRemoteFileOutboundGateway.java:240)
    at org.springframework.integration.sftp.gateway.SftpOutboundGateway.<init>(SftpOutboundGateway.java:45)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
    ... 16 more

ApplicationContext.xml

    <?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:context="http://www.springframework.org/schema/context"
    xmlns:task="http://www.springframework.org/schema/task"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                            http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context-4.0.xsd
                            http://www.springframework.org/schema/tx
                            http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
                            http://www.springframework.org/schema/task 
                            http://www.springframework.org/schema/task/spring-task-4.0.xsd                          
                            http://www.springframework.org/schema/integration   
                            http://www.springframework.org/schema/integration/spring-integration.xsd
                            http://www.springframework.org/schema/integration/sftp
                            http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">                    


    <context:component-scan base-package="com.canaldigital.tsi.bank" />
    <context:property-placeholder location="classpath:settings.properties" />   

    <bean id="defaultSftpSessionFactory"
            class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
        <property name="host" value="${sftp.host}"/>
        <property name="user" value="${sftp.username}"/>
    <!--    <property name="password" value="${sftp.password}"/>  -->
        <property name="port" value="${sftp.serverPort}"/>

        <!--  <property name="privateKey" value="${sftp.private.keyfile}"/> --> 
         <property name="privateKey" value="classpath:IBS_KEYS/id_rsa.txt"/>

         <property name="privateKeyPassphrase" value="${sftp.passphrase}"/>

    </bean>

    <bean id="sftpSessionFactory" class="org.springframework.integration.file.remote.session.CachingSessionFactory">
        <constructor-arg ref="defaultSftpSessionFactory" />
    </bean>

        <int-sftp:outbound-gateway id="gateway3"
                              session-factory="sftpSessionFactory"
                              request-channel="inbound1"
                              reply-channel="outbound"
                              auto-startup="true"
                              command="mv"
                              expression="/home/oracle/IBSTOBANK/Test/Outgoing/"
                              rename-expression="/home/oracle/IBSTOBANK/Test/Incoming/" />


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


<int:channel id="outbound"/>



</beans>
4

1 に答える 1

2

まずは SpELとは何かを勉強したほうが良さそうです。

だから、あなたの問題はここにあります:

expression="/home/oracle/IBSTOBANK/Test/Outgoing/"
rename-expression="/home/oracle/IBSTOBANK/Test/Incoming/"

どちらも正しい SpEL 式ではありません。

反対側から、本当に生のパス表現を意味する場合は、literalそこでトリックを使用する必要があります。これらの値を一重引用符で囲むだけです。

expression="'/home/oracle/IBSTOBANK/Test/Outgoing/'"
rename-expression="'/home/oracle/IBSTOBANK/Test/Incoming/'"
于 2015-08-17T15:29:48.100 に答える