2016-03-23 8 views
1
enter org.springframework.meption is javax.mail.NoSuchProviderException: imap 
    at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:125) 
    at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:175 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:224) 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:57) 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:176) 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:173) 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:330) 
    at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55) 
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) 
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51) 
    at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:324) 
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:483) 
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:316) 
    at org.springframework.scheduling.commonj.TimerManagerTaskScheduler$TimerScheduledFuture.timerExpired(TimerManagerTaskSched 
    at org.springframework.scheduling.commonj.TimerManagerTaskScheduler$ReschedulingTimerListener.timerExpired(TimerManagerTask 
    at com.ibm.ws.asynchbeans.timer.TimerImpl.callListenerMethod(TimerImpl.java:361) 
    at com.ibm.ws.asynchbeans.timer.GenericTimer.run(GenericTimer.java:228) 
    at com.ibm.ws.asynchbeans.J2EEContext$RunProxy.run(J2EEContext.java:267) 
    at java.security.AccessController.doPrivileged(AccessController.java:390) 
    at javax.security.auth.Subject.doAs(Subject.java:494) 
    at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:133) 
    at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:91) 
    at com.ibm.ws.asynchbeans.J2EEContext$DoAsProxy.run(J2EEContext.java:338) 
    at java.security.AccessController.doPrivileged(AccessController.java:420) 
    at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1174) 
    at com.ibm.ws.asynchbeans.timer.TimerImpl.runListenerAsCJWork(TimerImpl.java:490) 
    at com.ibm.ws.asynchbeans.am._Alarm.fireAlarm(_Alarm.java:340) 
    at com.ibm.ws.asynchbeans.am._Alarm.run(_Alarm.java:237) 
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881) 
Caused by: javax.mail.NoSuchProviderException: imap 
    at javax.mail.Session.getService(Session.java:798) 
    at javax.mail.Session.getStore(Session.java:578) 
    at javax.mail.Session.getStore(Session.java:540) 
    at org.springframework.integration.mail.AbstractMailReceiver.connectStoreIfNecessary(AbstractMailReceiver.java:239) 
    at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:259) 
    at org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:285) 
    at org.springframework.integration.mail.MailReceivingMessageSource.receive(MailReceivingMessageSource.java:111) 
    ... 29 morecode here 

接続の問題がないようにリモートサーバのIPをpingできます。 Tomcatで同じコードを実行しても問題ありません。 Web Sphereで展開すると同じコードでエラーが表示されます。 スタックオーバーフローで他のものを試してみました。 jarはactivation-1.1.jar、mail-1.4.5.jarです。 有用なポインタです。javax.mail.NoSuchProviderExceptionを取得する:メールサーバをポーリングしようとしたときにimap

+0

plaseはコードのスニペットを提供します... – Marcx

+0

春の統合を使用した接続http://docs.spring.io/spring-integration/reference/html/mail.html .... – user666

+0

できる場合は、 [JavaMail](https://java.net/projects/javamail/pages/Home)をバージョン1.5.3以降にアップグレードしてください。参照:[使用できないストアとトランスポートのクラスをスキップする](https://kenai.com/bugzilla/show_bug.cgi?id=6668)。それでも動作しない場合は、JavaMailデバッグ出力を提供してください。 – jmehrens

答えて

1

まあ、我々が使用する我々のテストでは、このGradleでは、メールアダプタの依存関係:

mailVersion = '1.5.5' 

testRuntime "com.sun.mail:javax.mail:$mailVersion" 
testRuntime "com.sun.mail:smtp:$mailVersion" 
testRuntime "com.sun.mail:pop3:$mailVersion" 
testRuntime "com.sun.mail:imap:$mailVersion" 

だから、あなたのプロジェクトのためのcom.sun.mail:imap:1.5.5を追加することを検討してください。

0

これらの回答とコメントは確かに参考になりました。 IMAPプロバイダの問題を解決し

<dependency> 
     <groupId>javax.mail</groupId> 
     <artifactId>javax.mail-api</artifactId> 
     <version>1.5.3</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.mail</groupId> 
     <artifactId>javax.mail</artifactId> 
     <version>1.5.3</version> 
    </dependency> 

- :

は当初、私は以下のコードを使用していました。すべてが地元で働いているが、私は、WebSphere上でコードを展開したときtext_plainがDataContenHandlerから延びるが、それはどこかにロードされたなっていた教えて別のクラスに文句に保管にもかかわらず、私はクラスのキャスト例外に

caused by: java.lang.ClassCastException: com.sun.mail.handlers.text_plain incompatible with javax.activation.DataContentHandler 

を得ていました。それから、以下のように活性化瓶を除外して動作させてください。

<dependency> 
     <groupId>javax.mail</groupId> 
     <artifactId>javax.mail-api</artifactId> 
     <version>1.5.3</version> 
     <exclusions> 
      <exclusion> 
       <artifactId>activation</artifactId> 
       <groupId>javax.activation</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.mail</groupId> 
     <artifactId>javax.mail</artifactId> 
     <version>1.5.3</version> 
     <exclusions> 
      <exclusion> 
       <artifactId>activation</artifactId> 
       <groupId>javax.activation</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 

ありがとうございます。

+0

com.sun.mail:javax.mail成果物には、imap、smtp、およびpop3のすべてのプロバイダが含まれているため、それらのために個別のjarファイルは必要ありません。これには完全なAPI定義も含まれているため、javax.mail-api成果物は必要ありません。成果物は[JavaMail Webページ](https://java.net/projects/javamail/pages/Home)に記載されています。 –

関連する問題