camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Maréchal (JIRA) <j...@apache.org>
Subject [jira] [Commented] (CAMEL-7431) Impossible to use an existing javax.mail.Session with DefaultJavaMailSender
Date Mon, 12 May 2014 13:10:16 GMT

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

Pierre Maréchal commented on CAMEL-7431:
----------------------------------------

StackTrace of the Exception :

javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 0;
  nested exception is:
	java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid
on remote machine
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)
	at javax.mail.Service.connect(Service.java:295)
	at org.apache.camel.component.mail.DefaultJavaMailSender.send(DefaultJavaMailSender.java:111)
	at org.apache.camel.component.mail.MailProducer.process(MailProducer.java:56)
	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
	at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:143)
	at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:307)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:138)
	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
	at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:73)
	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:378)
	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:346)
	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:242)
	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:346)
	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:168)
	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:119)
	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:359)
	at lu.chd.svc.mailing.service.MailingServiceImpl.sendMail(MailingServiceImpl.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:78)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
	at com.sun.proxy.$Proxy56.sendMail(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:212)
	at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:39)
	at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)
	at org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:114)
	at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:74)
	at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:445)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:556)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1044)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:372)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:978)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:369)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:486)
	at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:944)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1005)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.ConnectException: connect: Address is invalid on local machine, or port
is not valid on remote machine
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:529)
	at java.net.Socket.connect(Socket.java:478)
	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:321)
	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:237)
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1927)
	... 78 more

> Impossible to use an existing javax.mail.Session with DefaultJavaMailSender
> ---------------------------------------------------------------------------
>
>                 Key: CAMEL-7431
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7431
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mail
>    Affects Versions: 2.13.0
>         Environment: Windows 8.1.1, Oracle JDK6u45, JavaMail 1.4.7
>            Reporter: Pierre Maréchal
>
> When using DefaultJavaMailSender with an existing javax.mail.Session instance (i.e. retrieved
from JNDI) it is not possible to leave host and port unconfigured.
> My JavaMailSender is configured as follows:
>     @Bean
>     public JavaMailSender mailSender() {
>         JavaMailSender jms = new DefaultJavaMailSender();
>         jms.setSession(mailSession);
>         jms.setProtocol("smtp");
>         return jms;
>     }
> mailSession is a preconfigured Session instance retrieved from JNDI registry. I do not
know about it's configuration.
> When calling the send() method, it tries to connect using the connect(host, port, username,
password) method passing the (unconfigured) host and port which defaults to localhost:0 and
then fails.
> In case the session is supplied, it should call connect() instead.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message