camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alfred Hiebl <a.hi...@mic-cust.com>
Subject Mail component with starttls
Date Fri, 04 Mar 2011 13:57:22 GMT
Hi,

I am using the following two routes to send/receive mails through pop3 and
smtp using starttls:

  
:110?username=...&amp;password=...&amp;mail.pop3.starttls.required=true&amp;mail.pop3.starttls.enable=true&amp;delete=true"
/>
   



   
   test
   


Java options:
-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]



I think the problem is 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);
        }


How can I configure the mail component to use a different session for these
two routes?

Thanks a lot,
Alfred


--
View this message in context: http://camel.465427.n5.nabble.com/Mail-component-with-starttls-tp3409505p3409505.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message