camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alfred Hiebl (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-3769) Mail component issue with starttls option
Date Tue, 08 Mar 2011 16:18:00 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-3769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13004027#comment-13004027
] 

Alfred Hiebl commented on CAMEL-3769:
-------------------------------------

At least in my tests, the debugMode=true did not work either. I think this is beacuse 

{code}
// sets the debug mode of the underlying mail framework
answer.getSession().setDebug(debugMode);
{code}

creates a Session and sets the debug option for this session object. In the next few line
the JavaMailProperties are set

{code}
answer.setJavaMailProperties()
{code}

which actually resets the Session object in JavaMailSenderImpl answer to null.


> Mail component issue with starttls option
> -----------------------------------------
>
>                 Key: CAMEL-3769
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3769
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 2.6.0
>            Reporter: Alfred Hiebl
>
> The problem occurs when I read from a pop3 endpoint and send to an smtp endpoint in the
same camel context with the mail.pop3.starttls.enable=true and mail.smtp.starttls.enable=true
options.
> Required Java options for starttls are set:
> -Djavax.net.ssl.trustStore=D:\test\xxx.jks
> -Djavax.net.ssl.trustStorePassword=yyy
> When I only configure one of either route, everything works fine. When I configure both,
I get the following exception:
> AUTH LOGIN
> C: STAT
> 530 Must issue STARTTLS command first
> STARTTLS
> S: +OK 0 0
> C: NOOP
> 220 begin TLS negotiation
> S: +OK
> C: RSET
> S: +OK
> C: QUIT
> AUTH LOGIN
> S: +OK POP3 server closing connection
> 503 wrong state for AUTH command
> 2011-03-03 10:08:36,797 [foo] ERROR DefaultErrorHandler - Failed delivery for exchangeId:
ID-E6500-ahi-61446-1299143304838-0-2. Exhausted after delivery attempt: 1 caught: org.springframework.mail.MailAuthenticationException:
Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 503 wrong
state for AUTH command
> org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception
is javax.mail.AuthenticationFailedException: 503 wrong state for AUTH command
>         at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:392)[org.springframework.context.support-3.0.5.RELEASE.jar:3.0.5.RELEASE]
>         at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)[org.springframework.context.support-3.0.5.RELEASE.jar:3.0.5.RELEASE]
>         at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:355)[org.springframework.context.support-3.0.5.RELEASE.jar:3.0.5.RELEASE]
>         at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:344)[org.springframework.context.support-3.0.5.RELEASE.jar:3.0.5.RELEASE]
>         at org.apache.camel.component.mail.MailProducer.process(MailProducer.java:44)[camel-mail-2.6.0.jar:2.6.0]
>         at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:104)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:272)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:125)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.RoutePolicyProcessor.process(RoutePolicyProcessor.java:75)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:104)[camel-core-2.6.0.jar:2.6.0]
>         at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:49)[camel-core-2.6.0.jar:2.6.0]
>         at java.util.TimerThread.mainLoop(Unknown Source)[:1.5.0_22]
>         at java.util.TimerThread.run(Unknown Source)[:1.5.0_22]
> The problem seems to be in org.apache.camel.component.mail.MailConfiguration.createJavaMailSender()
where it uses the same mail session for both connection; see Session.getDefaultInstance below
>         if (session != null) {
>             answer.setSession(session);
>         } else {
>             // use our authenticator that does no live user interaction but returns the
already configured username and password
>             Session session;
>             try {
>                 session = Session.getDefaultInstance(answer.getJavaMailProperties(),
getAuthenticator());
>             } catch (Throwable t) {
>                 // fallback as default instance may not be allowed on some systems
>                 session = Session.getInstance(answer.getJavaMailProperties(), getAuthenticator());
>             }
>             answer.setSession(session);
>         }
> This is because getDefaultInstance creates a Session object the first time it is called.
Then it caches that Session and returns it for all subsequent calls. It also ignores the new
and different properties for the second route.
> See also http://camel.465427.n5.nabble.com/Mail-component-with-starttls-td3409505.html


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message