问题
Here is my xml:
<mail:inbound-channel-adapter id="imapAdapter"
store-uri="imaps://[avita.nir@gmail.com]:[secretPass]@imap.gmail.com/INBOX"
channel="recieveEmailChannel"
should-delete-messages="false"
should-mark-messages-as-read="true"
auto-startup="true"
java-mail-properties="javaMailProperties">
For some reason when i type this "store-uri" i get this exception (null password):
DEBUG: protocolConnect returning false, host=gmail.com], user=[avita.nir, password=<null>
21 יול 2013 15:32:05 ERROR LoggingHandler - org.springframework.integration.MessagingException: failure occurred while polling for mail
at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:73)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.doPoll(SourcePollingChannelAdapter.java:89)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:145)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:143)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:206)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:49)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:201)
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(ScheduledThreadPoolE xecutor.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)
Caused by: org.springframework.integration.MessagingException: failure occurred while receiving from folder
at org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:240)
at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:59)
... 18 more
Caused by: javax.mail.AuthenticationFailedException: failed to connect, no password specified?
回答1:
Remove the [ ] and you should be good - also if the username or password contains special characters you will have to escape them.
It's always useful to set mail.debug
to true for these issues and you'll get more information on the console.
来源:https://stackoverflow.com/questions/17772435/spring-integration-imap-credentials-issue