Note that there are some explanatory texts on larger screens.

plurals
  1. POHandle Null messages in Spring Integration
    text
    copied!<p>I'm using spring integration( <code>&lt;int-ftp:outbound-gateway &gt;</code>) to retrieve files from ftp server,</p> <p>First I couldn't continue the program if there were no files in the remote directory,I could solve that issue adding <code>default-reply-timeout="100"</code> to the <code>&lt;int:gateway&gt;</code>, after adding that I am getting null point exception which caused build failure.</p> <p>This is my full configuration file</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;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:int="http://www.springframework.org/schema/integration" xmlns:p="http://www.springframework.org/schema/p" xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp" xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt; &lt;context:property-placeholder location="classpath:host.properties"/&gt; &lt;int:gateway id="gw" service-interface="com.util.ToFtpFlowGateway" default-request-channel="inbound" default-reply-timeout="100"/&gt; &lt;bean id="downloadProcessBean" class="com.util.FTPDownloadInterceptor"&gt; &lt;property name="fileType" value="txt"/&gt; &lt;property name="sourceType" value="ftp"/&gt; &lt;property name="destinationName" value="destinationName"/&gt; &lt;property name="destinationQueName" value="destinationQueName"/&gt; &lt;property name="sourceAddressDetails" value="sourceAddressDetails"/&gt; &lt;property name="sourceName" value="sourceName"/&gt; &lt;/bean&gt; &lt;bean id="ftpSessionFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"&gt; &lt;property name="host" value="${local.host}"/&gt; &lt;property name="port" value="${local.availableServerPort}"/&gt; &lt;property name="username" value="${local.userid}"/&gt; &lt;property name="password" value="${local.user.password}"/&gt; &lt;/bean&gt; &lt;int-ftp:outbound-gateway id="gatewayLS" cache-sessions="false" session-factory="ftpSessionFactory" request-channel="inbound" command="ls" command-options="" expression="payload" reply-channel="toSplitter" /&gt; &lt;int:channel id="toSplitter"&gt; &lt;int:interceptors&gt; &lt;int:wire-tap channel="logger"/&gt; &lt;/int:interceptors&gt; &lt;/int:channel&gt; &lt;int:logging-channel-adapter id="logger" log-full-message="true" /&gt; &lt;int:splitter id="splitter" input-channel="toSplitter" output-channel="toGet"/&gt; &lt;int-ftp:outbound-gateway id="gatewayGET" cache-sessions="false" local-directory="/home/udeshika/project/sxpmsg-distributer/req/local/download" session-factory="ftpSessionFactory" request-channel="toGet" reply-channel="toRemoveChannel" command="get" command-options="-P" expression="payload.remoteDirectory + '/' + payload.filename" reply-timeout="10"/&gt; &lt;int-ftp:outbound-gateway id="gatewayRM" session-factory="ftpSessionFactory" cache-sessions="false" expression="payload.remoteDirectory + '/'+ payload.filename" request-channel="toRemoveChannel" command="rm" reply-channel="aggregateResultsChannel" auto-create-local-directory="true" reply-timeout="10" /&gt; &lt;!--&lt;bean id="fileDownloadIntecepter" class="shipxpress.util.FTPDownloadInterceptor"/&gt;--&gt; &lt;int:channel id="toRemoveChannel"&gt; &lt;int:interceptors&gt; &lt;int:wire-tap channel="logger2"/&gt; &lt;!--&lt;int:ref bean="fileDownloadIntecepter" /&gt;--&gt; &lt;/int:interceptors&gt; &lt;/int:channel&gt; &lt;bean class="org.springframework.integration.file.FileReadingMessageSource" p:directory="${download.directory}"/&gt; &lt;int:logging-channel-adapter id="logger2" log-full-message="true" /&gt; &lt;int-ftp:outbound-gateway id="gatewayRM" session-factory="ftpSessionFactory" cache-sessions="false" expression="headers['file_remoteDirectory'] + '/' + headers['file_remoteFile']" request-channel="toRemoveChannel" command="rm" reply-channel="aggregateResultsChannel"/&gt; &lt;int:aggregator input-channel="aggregateResultsChannel"/&gt; &lt;/beans&gt; </code></pre> <p>java code</p> <pre><code> rmResults = toFtpFlow.lsGetAndRmFiles("testftp"); if(null == rmResults)[ LOGGER.info("Null returned"); } </code></pre> <p>Error message</p> <pre><code>[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9.200s [INFO] Finished at: Thu Jun 20 15:48:43 IST 2013 [INFO] Final Memory: 15M/84M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default) on project ftp: An exception occured while executing the Java class. null: InvocationTargetException: message must not be null -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload