9 Replies Latest reply on Jun 23, 2009 12:25 PM by Christian Müller

    FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator

    Christian Müller Newbie

      Dear All,

       

      I have the following camel component/route, which works great in a pure camel project (I have a unittest which verified that). But if I deploy it in to FUSE ESB 4.1.0.0, I receive an exception:

       

       

      route:

       

       

       

      Any idea, which I miss or what is wrong? Google was not able to help me...

       

      Thanks,

      Christian

        • 1. Re: FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator
          Stan Lewis Novice

          It's probably an issue with the geronimo javamail provider, it doesn't really work that great with Camel and there's actually a disclaimer at the top of the camel-mail docs.   There's a work-around to embed the Sun javamail implementation in your bundle which is what Camel uses when you run the route standalone, more info is in ESB-681 .  Hope that helps!

          • 2. Re: FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator
            Christian Müller Newbie

            Hi Stan!

             

            Thank you for your quick reply.

            After I modified my pom.xml, described in bug report Link: ESB-681, I got the following exception, if I start the bundle:

             

            smx@root:osgi> start 154

            ERROR CommandLineExecutionFailed: org.apache.geronimo.gshell.command.CommandException: org.osgi.framework.BundleException: Unresolved constraint in bundle 154: package; (package=org.aspectj.weaver.loadtime)

             

            So, I modified the 'Embed-Dependency' definition, that the 'org.aspectj.weaver.*' should not added to the dependencies. I found the description here Link: apache-felix-maven-bundle-plugin-bnd:

             

            <Embed-Dependency>*;scope=compile|runtime;artifactId=!activation|aspectjweaver</Embed-Dependency>

             

            But it doesn't work. The dependencies to 'org.aspectj.weaver.*' is still in my MANIFEST.MF file...

             

            Any idea?

             

            Cheers,

            Christian

            • 3. Re: FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator
              Claus Ibsen Master

              Why is AspecjtJ weaver in the picture?

              Are you using it?

               

              And is it the manifest file of your bundle, eg your route/code?

              • 4. Re: FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator
                Claus Ibsen Master

                Looks like your mail server requires some authentication of some sort. Sending an email with an authenticated connection.

                 

                I do not think spring mail supports that out of the box. Have seen a discussion of this at:

                http://forum.springsource.org/showthread.php?p=242208

                 

                And there is a FAQ about Java Mail here

                http://www.scribd.com/doc/11385837/All-About-Java-Mail

                 

                But it is of course strange that it works outside FUSE ESB. But you said it was an unit test. Maybe this unit test uses some MockMail API and do not send to the real mail server?

                • 5. Re: FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator
                  Christian Müller Newbie

                  Hi Claus,

                   

                  thank you for your quick reply.

                  I installed apache james 2.3.1 and added only the to users, I uses in my sample. Every thing else is the james default.

                   

                  I added my simple pure camel project 'my-camel-sandbox', so you can have a look in it. It works (verified with the provided unit test and looking into the account with thunderbird).

                   

                  The second attachment is my camel component 'tmp-file-to-mail', which I have deployed into FUSE ESB 4.1.0.0. It dosn't work... :o(

                  I get the ERROR:

                  ERROR CommandLineExecutionFailed: org.apache.geronimo.gshell.command.CommandException: org.osgi.framework.BundleException: Unresolved constraint in bu

                  ndle 154: package; (package=org.aspectj.weaver.loadtime)

                   

                  Maybe some spring library I included, has a dependency to 'org.aspectj.weaver.*'?

                   

                  Cheers,

                  Christian

                  • 6. Re: FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator
                    Stan Lewis Novice

                    Hey Christian,

                     

                    It looks like it could be the problem is because you're including camel-core and camel-mail in your bundle (and I think all those spring dependencies as well).  I've made some changes to your pom.xml that seem to deploy properly at least.

                    • 7. Re: FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator
                      Christian Müller Newbie

                      Hi Stan!

                       

                      Thank you for taking time for my problem. With your pom.xml, I don't have the dependency to 'org.aspectj.weaver.*' anymore, but the geronimo mail implementation is still used and I get the same exception as before:

                       

                      16:37:46,549 | ERROR | Component@b874d2 | DeadLetterChannel                | rg.apache.camel.processor.Logger  203 | Failed delivery for exchangeId: ID-defm-ar063470/3773-1245766215454/0-2. On delivery attempt: 0 caught: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Unable to obtain SASL authenticator

                      org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Unable to obtain SASL authenticator

                           at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:419)

                           at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:342)

                           at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:357)

                           at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:346)

                           at org.apache.camel.component.mail.MailProducer.process(MailProducer.java:46)

                           at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)

                           at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:84)

                           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)

                           at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:189)

                           at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:133)

                           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)

                           at org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(StreamCachingInterceptor.java:87)

                           at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:82)

                           at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:52)

                           at org.apache.camel.component.file.FileConsumer.pollFile(FileConsumer.java:154)

                           at org.apache.camel.component.file.FileConsumer.pollFileOrDirectory(FileConsumer.java:90)

                           at org.apache.camel.component.file.FileConsumer.pollFileOrDirectory(FileConsumer.java:100)

                           at org.apache.camel.component.file.FileConsumer.poll(FileConsumer.java:66)

                           at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:66)

                           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)

                           at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)

                           at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)

                           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)

                           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)

                           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)

                           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)

                           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)

                           at java.lang.Thread.run(Thread.java:595)

                      Caused by: javax.mail.MessagingException: Unable to obtain SASL authenticator

                           at org.apache.geronimo.javamail.transport.smtp.SMTPConnection.processAuthentication(SMTPConnection.java:1050)

                           at org.apache.geronimo.javamail.transport.smtp.SMTPConnection.protocolConnect(SMTPConnection.java:165)

                           at org.apache.geronimo.javamail.transport.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:165)

                           at javax.mail.Service.connect(Service.java:248)

                           at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:389)

                           ... 27 more

                       

                      I added the generated osgi bundle. Any idea?

                       

                      Cheers,

                      Christian

                      • 8. Re: FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator
                        Stan Lewis Novice

                        Ah, you know I think when working on this I had also uninstalled the geronimo-javamail bundle altogether to be certain it wasn't getting picked up by my route.  Should just be a matter of doing an osgi/uninstall on it's bundle ID, you may then need to just restart your bundle.  I remember trying a few things to be sure geronimo-javamail wasn't in the picture, I'm just a bit fuzzy on what ultimately worked.

                        • 9. Re: FUSE ESB 4.1.0.0 and mail: Unable to obtain SASL authenticator
                          Christian Müller Newbie

                          Hi Stan!

                           

                          Thank you for the advice. After I uninstalled

                           

                          Apache ServiceMix Bundles: geronimo-javamail_1.4_provider-1.8-r755222 (1.8.0.r755222_1)

                           

                          the mail was sent!

                           

                           

                           

                          Thank you very much,

                          Christian