sirve requestparam que para mvc example espaƱol dispatcherservlet java spring ftp spring-integration

java - requestparam - spring mvc example



Spring MVC 3.2.8: FtpInboundFileSynchronizer (2)

Tengo una aplicación basada en Spring Web model-view-controller (Spring MVC 3.2.8) y quiero usar la integración con FTP utilizando la implementación predeterminada de FTP SessionFactory.

Tengo este pedazo de codigo

private void performImport() throws Exception { String fileNamePattern="*.txt"; ftpInboundFileSynchronizer = new FtpInboundFileSynchronizer(myFtpSessionFactory ); ((FtpInboundFileSynchronizer) ftpInboundFileSynchronizer).setFilter(new FtpSimplePatternFileListFilter(fileNamePattern)); ftpInboundFileSynchronizer.setRemoteDirectory(remoteDirectory); deleteLocalFiles(); System.out.println ("before synchronize"); ftpInboundFileSynchronizer.synchronizeToLocalDirectory(localDirectory); System.out.println ("after synchronize"); }

Esto es lo que veo en la consola:

before synchronize after synchronize

En el FTP tengo un archivo test.txt pero el archivo no se transfiere, y no tengo error / excepción

También intenté usar fileNamePattern="*.*"; pero tampoco funciona

Aquí mi archivo de configuración:

@Configuration @PropertySource("classpath:/config/application.properties") public class FtpConfiguration { @Autowired private SessionFactory myFtpSessionFactory; @Bean @Scope(value="step") public FtpGetRemoteFilesTasklet myFtpGetRemoteFilesTasklet() { FtpGetRemoteFilesTasklet ftpTasklet = new FtpGetRemoteFilesTasklet(); ftpTasklet.setRetryIfNotFound(true); ftpTasklet.setDownloadFileAttempts(3); ftpTasklet.setRetryIntervalMilliseconds(10000); ftpTasklet.setFileNamePattern("README"); //ftpTasklet.setFileNamePattern("TestFile"); ftpTasklet.setRemoteDirectory("/"); ftpTasklet.setLocalDirectory(new File(System.getProperty("java.io.tmpdir"))); ftpTasklet.setSessionFactory(myFtpSessionFactory); return ftpTasklet; } @Bean public SessionFactory myFtpSessionFactory() { DefaultFtpSessionFactory ftpSessionFactory = new DefaultFtpSessionFactory(); ftpSessionFactory.setHost("myhost.com"); ftpSessionFactory.setClientMode(0); ftpSessionFactory.setFileType(FTP.ASCII_FILE_TYPE); ftpSessionFactory.setPort(1029); ftpSessionFactory.setUsername("some_username"); ftpSessionFactory.setPassword("really-private-password"); return ftpSessionFactory; } }

y no hay nada relacionado con el FTP en el archivo de registro del servidor

(self-tuning)''> <<WLS Kernel>> <> <> <1500554849537> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/template/LHheader.jsp> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849554> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/template/popupHeader.jsp> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849575> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/template/PopupTemplate.jsp> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849596> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/template/Template.jsp> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849612> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/welcome/defaultMenuBody.jsp> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849626> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/welcome/logoutBody.jsp> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849643> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/welcome/welcome.jsp> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <HTTP> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849663> <BEA-101341> <ecolabelEar: Class file up-to-date for JSP: /WEB-INF/jsp/welcome/welcomeBody.jsp> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849839> <BEA-149060> <Module devices of application ecolabelEar successfully transitioned from STATE_NEW to STATE_PREPARED on server myserver.> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <WebLogicServer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849861> <BEA-000256> <Invoking weblogic.transaction.internal.StartupClass.main(null)> ####<20-Jul-2017 14:47:29 o''clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554849872> <BEA-149059> <Module devices of application ecolabelEar is transitioning from STATE_PREPARED to STATE_ADMIN on server myserver.> ####<20-Jul-2017 14:47:30 o''clock CEST> <Info> <org.hibernate.validator.engine.resolver.DefaultTraversableResolver> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554850444> <BEA-000000> <Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.> ####<20-Jul-2017 14:47:30 o''clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554850447> <BEA-149060> <Module devices of application ecolabelEar successfully transitioned from STATE_PREPARED to STATE_ADMIN on server myserver.> ####<20-Jul-2017 14:47:30 o''clock CEST> <Info> <ServletContext-/devices> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<anonymous>> <> <> <1500554850652> <BEA-000000> <Initializing Spring root WebApplicationContext> ####<20-Jul-2017 14:47:40 o''clock CEST> <Info> <org.hibernate.validator.engine.resolver.DefaultTraversableResolver> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<anonymous>> <> <> <1500554860329> <BEA-000000> <Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.> ####<20-Jul-2017 14:47:40 o''clock CEST> <Info> <ServletContext-/devices> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<anonymous>> <> <> <1500554860918> <BEA-000000> <Initializing log4j from [classpath:com/devices//log4j.properties]> ####<20-Jul-2017 14:47:41 o''clock CEST> <Debug> <SecurityAtn> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554861044> <BEA-000000> <EcasServletAuthenticationFilter@11e13f4 : init weblogic.security.service.internal.ServletAuthenticationFilterServiceImpl$FilterConfigImpl@ec4bb2 for context: ServletContext@13293236[app:ecolabelEar module:devices path:/devices spec-version:3.0]> ####<20-Jul-2017 14:47:41 o''clock CEST> <Debug> <SecurityAtn> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554861496> <BEA-000000> <Registered JASPIC AuthConfigProvider for application.> ####<20-Jul-2017 14:47:41 o''clock CEST> <Info> <ServletContext-/devices> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<anonymous>> <> <> <1500554861542> <BEA-000000> <Initializing Spring FrameworkServlet ''ecolabelWeb''> ####<20-Jul-2017 14:47:42 o''clock CEST> <Info> <org.hibernate.validator.engine.resolver.DefaultTraversableResolver> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<anonymous>> <> <> <1500554862961> <BEA-000000> <Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Info> <Diagnostics> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866282> <BEA-320000> <The Diagnostics subsystem is initializing on Server myserver.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Info> <Log Management> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866314> <BEA-170025> <Initialized Domain Logging. Domain log events will be written to C:/Development/Domains/devices/servers/myserver/logs/mydomain.log.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Notice> <Log Management> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866315> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Info> <Diagnostics> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866401> <BEA-320077> <Initialized the Diagnostic Accessor Service.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Info> <Log Management> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866436> <BEA-170031> <The default Server Logging bridge has been initialized successfully.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <main> <<WLS Kernel>> <> <> <1500554866456> <BEA-000365> <Server state changed to ADMIN.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <main> <<WLS Kernel>> <> <> <1500554866537> <BEA-000365> <Server state changed to RESUMING.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866541> <BEA-149059> <Module devices of application ecolabelEar is transitioning from STATE_ADMIN to STATE_ACTIVE on server myserver.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Info> <Deployer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866542> <BEA-149060> <Module devices of application ecolabelEar successfully transitioned from STATE_ADMIN to STATE_ACTIVE on server myserver.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Info> <Management> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''2'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866549> <BEA-141052> <The auto deployment poller has started.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Info> <Server> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866563> <BEA-002610> <Dynamic Listener Service initialized.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Notice> <Server> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866564> <BEA-002613> <Channel "Default" is now listening on 158.166.167.112:7001 for protocols iiop, t3, ldap, snmp, http.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Warning> <Server> <D02DI1350859ENV> <myserver> <DynamicListenThread[Default]> <<WLS Kernel>> <> <> <1500554866564> <BEA-002611> <The hostname "D02DI1350859ENV.net8.pep.ant", maps to multiple IP addresses: 158.166.167.112, 0:0:0:0:0:0:0:1.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Notice> <Server> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866564> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Notice> <Server> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866565> <BEA-002613> <Channel "Default[2]" is now listening on 0:0:0:0:0:0:0:1:7001 for protocols iiop, t3, ldap, snmp, http.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866565> <BEA-000331> <Started the WebLogic Server Administration Server "myserver" for domain "mydomain" running in development mode.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <main> <<WLS Kernel>> <> <> <1500554866595> <BEA-000365> <Server state changed to RUNNING.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Notice> <WebLogicServer> <D02DI1350859ENV> <myserver> <main> <<WLS Kernel>> <> <> <1500554866596> <BEA-000360> <The server started in RUNNING mode.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Debug> <SecurityAtn> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866645> <BEA-000000> <Beginning getServletAuthenticationFilters.> ####<20-Jul-2017 14:47:46 o''clock CEST> <Debug> <SecurityAtn> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''0'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554866645> <BEA-000000> <PrincipalAuthenticator.getServletAuthenticationFilters will use WLS-specific security service> ####<20-Jul-2017 14:47:48 o''clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''3'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554868336> <BEA-010009> <EJB deployed EJB with JNDI name ejb.mgmt.MEJB.> ####<20-Jul-2017 14:47:48 o''clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''3'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554868337> <BEA-014022> <javax.management.j2ee.ManagementHome is bound with JNDI name java:module/Mejb!javax.management.j2ee.ManagementHome.> ####<20-Jul-2017 14:47:48 o''clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''3'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554868337> <BEA-014022> <javax.management.j2ee.ManagementHome is bound with JNDI name java:global/mejb/Mejb!javax.management.j2ee.ManagementHome.> ####<20-Jul-2017 14:47:48 o''clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''3'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554868337> <BEA-014022> <javax.management.j2ee.ManagementHome is bound with JNDI name java:app/mejb/Mejb!javax.management.j2ee.ManagementHome.> ####<20-Jul-2017 14:47:48 o''clock CEST> <Info> <EJB> <D02DI1350859ENV> <myserver> <[ACTIVE] ExecuteThread: ''3'' for queue: ''weblogic.kernel.Default (self-tuning)''> <<WLS Kernel>> <> <> <1500554868337> <BEA-014021> <The EJB Mejb(Application: mejb, EJBComponent: mejb.jar) has been successfully deployed. The following remote interfaces have been bound into JNDI with the specified JNDI names:> ####<20-Jul-2017 14:48:46 o''clock CEST> <Info> <Health> <D02DI1350859ENV> <myserver> <weblogic.GCMonitor> <<anonymous>> <> <> <1500554926432> <BEA-310002> <50% of the total memory in the server is free.>

Aquí los archivos de configuración:

<?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:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd "> <!-- Use annotations to inject stuff --> <context:annotation-config /> <mvc:annotation-driven /> <!-- Scan for controllers --> <context:component-scan base-package="com.no.en.tenim.ni.cinc.controller.image" /> <context:component-scan base-package="com.no.en.tenim.ni.cinc.controller" /> <context:component-scan base-package="com.no.en.tenim.ni.cinc.audit" /> <context:component-scan base-package="com.no.en.tenim.ni.cinc.domain.formBeans" /> <context:component-scan base-package="com.no.en.tenim.ni.cinc.utils" /> <bean id="resultDecider" class="com.no.en.tenim.ni.cinc.audit.DevicesResultDecider"/> <bean id="userLocator" class="com.no.en.tenim.ni.cinc.audit.BaseContextUserLocator"/> <!-- automatically import all controller beans --> <import resource="classpath:com/nicinc/Devices/controller/**/*Controller.xml" /> <!-- The multipartResolver specifies in what way a multi part request should be treated. This enables file upload capabilities. --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> </bean> <bean name="viewBasenames" factory-bean="classpathBasenamePatternresolver" factory-method="resolve"> <constructor-arg> <list> <value>views.**</value> </list> </constructor-arg> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver"> <property name="basenames" ref="viewBasenames" /> </bean> <!-- Maps incoming URLs to classnames --> <bean name="controllerHandler" class="springext.web.servlet.mvc.support.ControllerClassNameHandlerMapping"> <property name="basePackage" value="com.no.en.tenim.ni.cinc.controller" /> <property name="interceptors"> <list> <!-- Checks a specific request parameter if the locale is changed. --> <ref bean="localeChangeInterceptor" /> <ref bean="sessionInterceptor" /> </list> </property> </bean> <!-- Action URL mappings to controllers. --> <bean id="handlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"> <property name="interceptors"> <list> <!-- Checks a specific request parameter if the locale is changed. --> <ref bean="localeChangeInterceptor"/> <ref bean="sessionInterceptor"/> </list> </property> </bean> <bean name="formController" abstract="true"> <property name="bindOnNewForm" value="true" /> <property name="sessionForm" value="true" /> <property name="synchronizeOnSession" value="true" /> <property name="propertyEditorRegistrar" ref="propertyEditorRegistrar" /> </bean> <!-- Resolves view name to template & body --> <bean name="templateViewResolver" class="springext.web.servlet.mvc.support.TemplateViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="templateMap"> <bean class="springext.web.servlet.mvc.support.TemplateMapFactory"> <property name="templateDir" value="/WEB-INF/jsp/template/" /> <property name="templateSuffix" value="Template.jsp" /> <property name="bodySuffix" value="Body.jsp" /> </bean> </property> </bean> </beans>

y el otro

<?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:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd"> <!-- As of Spring Security 4.0, CSRF protection is enabled by default with XML configuration --> <security:global-method-security secured-annotations="enabled" /> <security:http auto-config="true"> <security:csrf/> <security:intercept-url pattern="/**" access="permitAll" /> </security:http> <security:authentication-manager/> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/> <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"> <property name="customEditors"> <map> <entry key="java.util.List"> <bean class="com.no.en.tenim.ni.cinc.support.beans.ListPropertyEditor" /> </entry> </map> </property> </bean> <bean id="sessionInterceptor" class="com.no.en.tenim.ni.cinc.support.context.SessionInterceptor" /> <!-- The locale resolver determines the locale of a request. --> <!-- In this example a cookie is used to store the chosen language. --> <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"> <property name="defaultLocale" value="en_GB" /> <!-- <property name="paramName" value="language" /> --> </bean> <!-- The locale change interceptor checks a specific request parameter if the locale is changed. --> <!-- In this example the request parameter called ''locale'' is checked. --> <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" /> <bean name="classpathBasenamePatternresolver" class="com.no.en.tenim.ni.cinc.support.resource.ClassPathBaseNamePatternResolver"> </bean> <bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="locations"> <list><value>classpath:config/application.properties</value></list> </property> </bean> <!-- used for internationalized messages, e.g.: validation errors or instant help text. --> <bean id="messageSource" class="com.no.en.tenim.ni.cinc.support.context.EnglishMessageSource"> <property name="dao"> <ref bean="databaseMessageSourceDao" /> </property> <property name="defaultLanguage"> <value>en</value> </property> <property name="useCache"> <value>false</value> </property> </bean> <bean name="dateFormat" class="java.text.SimpleDateFormat"> <constructor-arg value="dd/MM/yyyy" /> </bean> <bean name="customDateEditor" class="org.springframework.beans.propertyeditors.CustomDateEditor"> <constructor-arg ref="dateFormat" /> <constructor-arg value="true" /> </bean> <bean name="CustomDictionaryEditor" class="com.no.en.tenim.ni.cinc.support.controller.CustomDictionaryEditor"> </bean> <bean id="propertyEditorRegistrar" class="com.no.en.tenim.ni.cinc.support.controller.CustomPropertyEditorRegistrar"> <property name="editors"> <map> <entry key="java.util.Date" value-ref="customDateEditor" /> <entry key="com.no.en.tenim.ni.cinc.domain.ProductGroup" value-ref="CustomDictionaryEditor" /> <entry key="com.no.en.tenim.ni.cinc.domain.ServiceGroup" value-ref="CustomDictionaryEditor" /> <entry key="com.no.en.tenim.ni.cinc.domain.CompetentBody" value-ref="CustomDictionaryEditor" /> <entry key="com.no.en.tenim.ni.cinc.domain.Country" value-ref="countryReferencePropertyEditor" /> <entry key="com.no.en.tenim.ni.cinc.domain.ApplicationSignatory" value-ref="CustomDictionaryEditor" /> <entry key="com.no.en.tenim.ni.cinc.domain.Description" value-ref="descriptionReferencePropertyEditor" /> <entry key="com.no.en.tenim.ni.cinc.domain.Language" value-ref="languageReferencePropertyEditor" /> <entry key="com.no.en.tenim.ni.cinc.domain.ServiceRating" value-ref="serviceRatingReferencePropertyEditor" /> <entry key="com.no.en.tenim.ni.cinc.domain.AccomodationType" value-ref="accomodationTypeReferencePropertyEditor" /> </map> </property> </bean> <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <value> com.no.en.tenim.ni.cinc.domain.security.SessionExpiredException=noSessionView com.no.en.tenim.ni.cinc.domain.security.NoSufficientRoleException=noRoleView com.no.en.tenim.ni.cinc.domain.security.NoAccessException=noRoleView com.no.en.tenim.ni.cinc.domain.security.NoUserException=noUserView </value> </property> </bean> <bean id="sessionHelper" class="com.no.en.tenim.ni.cinc.controller.util.SessionHelper"> </bean> <bean id="userMessagesManager" class="com.no.en.tenim.ni.cinc.support.controller.UserMessagesManager" scope="session"> <aop:scoped-proxy/> </bean> </beans>


Hey, simplemente intente esta configuración de configuración para la conexión FTP. Espero que resolverá tu problema.

import java.util.List; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.integration.annotation.MessagingGateway; import org.springframework.integration.annotation.ServiceActivator; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.interceptor.WireTap; import org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.Option; import org.springframework.integration.ftp.gateway.FtpOutboundGateway; import org.springframework.integration.ftp.session.DefaultFtpSessionFactory; import org.springframework.integration.handler.LoggingHandler; import org.springframework.integration.handler.LoggingHandler.Level; import org.springframework.messaging.MessageChannel; @Configuration public class FtpConfiguration { @ServiceActivator(inputChannel = "ftpLS") @Bean public FtpOutboundGateway getGW() { FtpOutboundGateway gateway = new FtpOutboundGateway(sf(), "ls", "payload"); gateway.setOption(Option.NAME_ONLY); gateway.setOutputChannelName("results"); return gateway; } @Bean public MessageChannel results() { DirectChannel channel = new DirectChannel(); channel.addInterceptor(tap()); return channel; } @Bean public WireTap tap() { return new WireTap("logging"); } @ServiceActivator(inputChannel = "logging") @Bean public LoggingHandler logger() { LoggingHandler logger = new LoggingHandler(Level.INFO); logger.setLogExpressionString("''Files:'' + payload"); return logger; } @Bean public DefaultFtpSessionFactory sf() { DefaultFtpSessionFactory sf = new DefaultFtpSessionFactory(); sf.setHost("localhost"); sf.setPort(2121); sf.setUsername("anonymous"); sf.setPassword(""); return sf; } @MessagingGateway(defaultRequestChannel = "ftpLS", defaultReplyChannel = "results") public interface Gate { List list(String directory); } }


Utilice el método de abajo y espero que funcione para usted.

import org.apache.commons.net.ftp.FTPClient; public boolean uploadFile(String localFilePath, String remotePath, String ftpHost, int ftpPort, String ftpUser, String ftpPassword) { FTPClient ftpClient = new FTPClient(); boolean uploaded = false; try { ftpClient.connect(ftpHost, ftpPort); boolean login = ftpClient.login(ftpUser, ftpPassword); ftpClient.enterLocalPassiveMode(); if (login) { File firstLocalFile = new File(localFilePath); LOG.info("local file location: "+ firstLocalFile); LOG.info("ftp location: "+ remotePath); InputStream inputStream = new FileInputStream(firstLocalFile); uploaded = ftpClient.storeFile(remotePath, inputStream); inputStream.close(); } else { LOG.info("Connection fail..."); } } catch (SocketException e) { LOG.error(e); } catch (IOException e) { LOG.error(e); } finally { try{ if(ftpClient != null){ ftpClient.logout(); ftpClient.disconnect(); } }catch(Exception e){ LOG.error(e); } } if (uploaded) { LOG.info("File uploaded successfully !"); return true; } else { LOG.info("Error in uploading file !"); return false; } }