Announcement Announcement Module
Collapse
No announcement yet.
spring mvc + int-mail:imap-idle-channel-adapter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring mvc + int-mail:imap-idle-channel-adapter

    I am very sorry I only speak a little English

    I use
    • spring.integration.version v2.2.0.RELEASE
    • javax.mail[mail] 1.4.7
    • spring 3.1.0.RELEASE

    I tried to use different versions of javax.mail[mail] 1.4.5 1.4.6

    I have a problem any tip ?






    Code:
    DEBUG: org.springframework.integration.mail.ImapIdleChannelAdapter - waiting for mail
    DEBUG: org.springframework.integration.mail.ImapMailReceiver - opening folder [imaps://******:*****@mail.test.de:993/inbox]
    DEBUG: org.springframework.integration.mail.ImapMailReceiver - This email server does not support RECENT or USER flags. System flag 'Flag.FL
    AGGED' will be used to prevent duplicates during email fetch.
    INFO : org.springframework.integration.mail.ImapMailReceiver - attempting to receive mail from folder [INBOX]
    DEBUG: org.springframework.integration.mail.ImapMailReceiver - This email server does not support RECENT or USER flags. System flag 'Flag.FL
    AGGED' will be used to prevent duplicates during email fetch.
    DEBUG: org.springframework.integration.mail.ImapMailReceiver - found 1 new messages
    WARN : org.springframework.integration.mail.ImapIdleChannelAdapter - Failed to execute IDLE task. Will attempt to resubmit in 10000 millisec
    onds.
    java.lang.NullPointerException
            at javax.mail.internet.ParameterList.set(ParameterList.java:220)
            at com.sun.mail.imap.protocol.BODYSTRUCTURE.parseParameters(BODYSTRUCTURE.java:404)
            at com.sun.mail.imap.protocol.BODYSTRUCTURE.<init>(BODYSTRUCTURE.java:224)
            at com.sun.mail.imap.protocol.BODYSTRUCTURE.<init>(BODYSTRUCTURE.java:109)
            at com.sun.mail.imap.protocol.BODYSTRUCTURE.<init>(BODYSTRUCTURE.java:109)
            at com.sun.mail.imap.protocol.FetchResponse.parseItem(FetchResponse.java:198)
            at com.sun.mail.imap.protocol.FetchResponse.parse(FetchResponse.java:164)
            at com.sun.mail.imap.protocol.FetchResponse.<init>(FetchResponse.java:92)
            at com.sun.mail.imap.protocol.IMAPProtocol.readResponse(IMAPProtocol.java:288)
            at com.sun.mail.iap.Protocol.command(Protocol.java:313)
            at com.sun.mail.imap.protocol.IMAPProtocol.fetch(IMAPProtocol.java:1543)
            at com.sun.mail.imap.protocol.IMAPProtocol.fetch(IMAPProtocol.java:1524)
            at com.sun.mail.imap.IMAPFolder.fetch(IMAPFolder.java:1094)
            at org.springframework.integration.mail.AbstractMailReceiver.fetchMessages(AbstractMailReceiver.java:343)
            at org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:245)
            at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:199)
            at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:169)
            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:471)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
            at java.util.concurrent.FutureTask.run(FutureTask.java:166)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
            at java.lang.Thread.run(Thread.java:722)
    In standalone application my configurations works! In the web application no !

    Code:
    <int-mail:imap-idle-channel-adapter id="imapAdapter"
    		store-uri="${imap.store-uri}" 
    		java-mail-properties="javaMailProperties"
    		channel="recieveEmailChannel" 
    		should-delete-messages="true"
    		should-mark-messages-as-read="true" 
    		auto-startup="true">
    </int-mail:imap-idle-channel-adapter>
    
    
    	<int:channel id="recieveEmailChannel">
    		<int:interceptors>
                <int:wire-tap channel="logger"/>
            </int:interceptors>
    	</int:channel>
    	
    	<int:chain id="transform-split" input-channel="recieveEmailChannel" output-channel="outputChannel">
    		<int:transformer>
    			<bean class="EmailTransformer" />
    		</int:transformer>
    		<int:splitter>
    			<bean class="EmailSplitter" />
    		</int:splitter>
    	</int:chain>
    
    
    	<int:channel id="outputChannel" />
    	<int-file:outbound-channel-adapter id="save-as-file" auto-create-directory="true" channel="outputChannel"
    		directory-expression="'${root-directory-attachments}' + headers.directory" />
    		
    	<util:properties id="javaMailProperties">
    		<prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
    		<prop key="mail.imap.socketFactory.fallback">false</prop>
    		<prop key="mail.store.protocol">imaps</prop>
    		<prop key="mail.debug">${imap.mail-debug}</prop>
    	</util:properties>

  • #2
    Best guess is your app server uses an "old" version of java mail.

    The ParameterList.set() methods
    Code:
    javax.mail.internet.ParameterList.set(ParameterList.java:220)
    are at a much higher line number in 1.4.5 and 1.4.6 (around line 500).

    Looks like BODYSTRUCTURE passes in null in the name argument; there's a comment in 1.4.5 and 1.4.6...

    Code:
    B/S@404:	    list.set(null, "DONE");	// XXX - hack
    
    ...
    
        public void set(String name, String value) {
    	// XXX - an incredible kludge used by the IMAP provider
    	// to indicate that it's done setting parameters
    	if (name == null && value != null && value.equals("DONE")) {
    ...
    Looks like they added code to handle this specific case. So, it looks like you have an older version.

    Comment


    • #3
      Great suggestion thank you, I changed the version jetty plugin. work ...

      Comment

      Working...
      X