Spring集成imap适配器异常

时间:2014-11-09 03:10:28

标签: spring spring-integration geronimo

我正在尝试使用spring itegration imap入站适配器,但每次运行我的应用程序时都会收到此异常

java.lang.NoSuchMethodException: org.apache.geronimo.javamail.store.imap.IMAPSSLStore.        <init>(javax.mail.Session, javax.mail.URLName)
    at java.lang.Class.getConstructor0(Class.java:2971)
    at java.lang.Class.getConstructor(Class.java:1812)
    at javax.mail.Session.getService(Session.java:799)
    at javax.mail.Session.getStore(Session.java:586)
    at javax.mail.Session.getStore(Session.java:548)
    at org.springframework.integration.mail.AbstractMailReceiver.openSession(AbstractMailReceiver.java:207)
    at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:226)
    at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:148)
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:220)
    at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:190)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

我的弹簧配置是这个

<int-mail:imap-idle-channel-adapter id="imapAdapter"
      store-uri="imaps://username:password1@imap.gmail.com:993/inbox"
      java-mail-properties="javaMailProperties"
      channel="receiveChannel"
      should-delete-messages="false"
      should-mark-messages-as-read="false"
      auto-startup="true"/>


<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">true</prop>
 </util:properties>

任何人都有任何想法?

1 个答案:

答案 0 :(得分:1)

您很可能使用的是不兼容的(可能是旧的)JavaMail版本。您使用的是哪个版本的geronimo?

使用javax.mail 1.5.2(以及com。sun.mail实现)构建/测试Spring集成。