Moqui 1.5.4 で電子メール サーバーをポーリングしようとしています。「ツール」アプリケーションから org.moqui.impl.EmailServices.poll#EmailServer を使用しています。
メールサーバーは次のように設定されています。
<moqui.basic.email.EmailServer emailServerId="testEmail" mailUsername="test.account@xxxxxxx.ie" mailPassword="xxxxxxxx" smtpHost="" smtpPort="" smtpSsl="" storeHost="Webmail8.xxxxxxxxxxx.ie" storePort="993" storeProtocol="imap" storeDelete="N" />
すべてのエントリ、パスワードは Outlook でテストされており、サーバーに問題なく接続されています。
javax.mail.AuthenticationFailedException が発生します。
追加情報:
最初のテストで、次のエラー メッセージを受け取ったので、コード内の指定された行から「static」修飾子を削除しました。(それが問題なのか、何か間違ったことをしている可能性があるのか 、まだわかりませんでした。)
--- 98330 [ndlerThread[15]] WARN moqui.impl.context.TransactionFacadeImpl
Transaction rollback. The rollback was originally caused by: startup failed:
classpath_//org/moqui/impl/pollEmailServer_groovy: 28: Modifier 'static' not allowed here.
@ line 28, column 1.
final static Logger logger = LoggerFactory.getLogger("org.moqui.impl.pollEmailServer")
問題を解決できるかどうかを確認しようとしたことには、次のようなものがあります。
- storeProtocol="imaps" の設定
- EmailServer エントリに smtp の詳細を含めます (メールを送信するのではなく、ポーリングするだけでよいことに注意してください)。
次の行を pollEmailServer.groovy に追加します (com.sun.mail.imap パッケージを参照)。
sessionProperties.put("mail.imap.ssl.enable", true)
完全認証失敗のエラー メッセージは次のとおりです。
サービス [org.moqui.impl.EmailServices.poll#EmailServer] の実行中にエラーが発生しました (Throwable)
javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:306)
at javax.mail.Service.connect(Service. java:156)
で javax.mail.Service.connect(Service.java:105)
で pollEmailServer_groovy.run(pollEmailServer_groovy:47)
で org.moqui.impl.context.runner.GroovyScriptRunner.run(GroovyScriptRunner.groovy:50)
でorg.moqui.impl.service.runner.ScriptServiceRunner.runService
(ScriptServiceRunner.groovy:49) のorg.moqui.impl.context.ResourceFacadeImpl.script(ResourceFacadeImpl.groovy:337 )
org.moqui.impl.service.ServiceCallSyncImpl.callSingle(ServiceCallSyncImpl.groovy:260)
で org.moqui.impl.service.ServiceCallSyncImpl.call(ServiceCallSyncImpl.groovy:137)
で ServiceRun_xml_transition_run_actions.run(ServiceRun_xml_transition_run_actions:10)
で org. org.moqui.impl.screen.ScreenDefinition
$TransitionItem.run(ScreenDefinition.groovy:659)で moqui.impl.actions.XmlAction.run (XmlAction.groovy:99)
org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition( ScreenRenderImpl.groovy:223)
で org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:217)
で org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:217) で
org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:217)
で org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:217)
で org.moqui.impl.screen.ScreenRenderImpl.internalRender (ScreenRenderImpl.groovy:301)
org.moqui.impl.screen.ScreenRenderImpl.render(ScreenRenderImpl.groovy:164)
で org.moqui.impl.webapp.MoquiServlet.doScreenRequest(MoquiServlet.groovy:71)
で org.moqui.
javax.servlet.http.HttpServlet.service(HttpServlet.java:713)のimpl.webapp.MoquiServlet.doPost(MoquiServlet.groovy:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:806) の
net.winstone.core.ServletCotion.execute(ServletConfiguration.java:270)
で net.winstone.core.SimpleRequestDispatcher.forward(SimpleRequestDispatcher.java:290)
で net.winstone.core.listener.RequestHandlerThread.processRequest(RequestHandlerThread.java ) :212
)
java.util.concurrent.FutureTask
. run(FutureTask.java:266)
at net.winstone.util.BoundedExecutorService$1.run(BoundedExecutorService.java:81)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
で java.lang.Thread.run(Thread.java:745) で
補遺: 電子メール ECA ルールでポーリングされたメッセージの処理。
EmailEcaRule.groovy でロガー情報をオンにすると、Email ECA の条件が「false」と評価され続けることがわかります。しかし、そうすべきではありませんか?
======== EMECA Process Received Email conditionPassed? false My condition: TestEmail fields:
(「My condition: ${fields.subject}」をロガー情報に挿入して、条件式が本来あるべき状態であることを再確認したことに注意してください。)
私のエメカは:
<emecas xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/email-eca-1.5.xsd">
<emeca rule-name="Process Received Email">
<condition><expression>fields.subject == 'TestEmail'</expression></condition>
<actions>
<service-call name="org.moqui.impl.EmailServices.save#EcaEmailMessage" />
</actions>
</emeca>
</emecas>
私はこれをテストし、再テストしました。false と評価される理由がわかりません。追加情報が必要な場合はお知らせください。
これを解決するにはまだ運がありません。私は愚かなことをしているに違いない。EmailEcaRule.groovy で if (conditionPassed) {} をコメントアウトして、Email ECA ルールの条件をバイパスし、アクションを実行しましたが、「null オブジェクトでメソッド get() を呼び出せません」というエラーでハングアップしました。 org.moqui.impl.EmailServices.save#EcaEmailMessage、おそらく headers.get('message-id') で。しかし、ログ情報で、メッセージ ID がヘッダー情報にあり、正常に小文字に変換されていることがわかります。