git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sporadic "Error while attempting to add new Connection to the pool; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.BindException: Address already in use: connect"


This means that you're trying to create more outbound sockets in a short
time than your host allows. See
https://stackoverflow.com/questions/4708649/java-net-bindexception-address-already-in-use-when-trying-to-do-rapid-socket
for a more detailed explanation.

This could happen if you have an unreasonably large connection pool, but
yours is only set to 25 so that's not it. It could also happen if your
process restarted many times in a row in quick succession, consuming 25
sockets at a time. Is it possible that that's what happened?

Tim

On Tue, Jul 31, 2018, 9:23 AM bocamel <johnzyin@xxxxxxxxx> wrote:

> My Camel/ActiveMQ application (using SpringBoot) has worked well for many
> months but suddenly we started to get the said error once in a while.
> Upgrading from 5.14.2 to 5.15.4 did not help.  The traffic is not heavy at
> all (less than 10 messages per minute).  The application passes messages to
> another process (exchangePattern=INOUT, with requestTimeout=35000).
> Here is the stacktrace, followed by activemq config and the camel route.
> Look at the Windows processes, nothing else uses port 61616 except the
> activeMQ broker.  Any help will be greatly appreciated.
>
>  Stacktrace: org.springframework.jms.UncategorizedJmsException:
> Uncategorized exception occurred during JMS processing; nested exception is
> javax.jms.JMSException: Error while attempting to add new Connection to the
> pool; nested exception is javax.jms.JMSException: Could not connect to
> broker URL: tcp://localhost:61616. Reason: java.net.BindException: Address
> already in use: connect
>         at
>
> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
>         at
>
> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
>         at
> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:487)
>         at
>
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:433)
>         at
> org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:409)
>         at
>
> org.apache.camel.component.jms.JmsProducer.processInOut(JmsProducer.java:239)
>         at
> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:150)
>         at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
>         at
>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
>
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
>         at
>
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)
>         at
>
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
>
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
>         at
>
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.asyncInvoke(CxfRsInvoker.java:95)
>         at
>
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:69)
>         at
>
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
>         at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189)
>         at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
>         at
>
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
>         at
>
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
>         at
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>         at
>
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>         at
>
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:262)
>         at
>
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:234)
>         at
>
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:76)
>         at
>
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
>         at
>
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
>         at
>
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
>         at
>
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:170)
>         at
>
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
>         at
>
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>         at
>
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
>         at
>
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:118)
>         at
>
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
>         at org.eclipse.jetty.server.Server.handle(Server.java:564)
>         at
> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
>         at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
>         at
> org.eclipse.jetty.io
> .AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
>         at org.eclipse.jetty.io
> .FillInterest.fillable(FillInterest.java:110)
>         at
> org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:258)
>         at
> org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:147)
>         at org.eclipse.jetty.io
> .FillInterest.fillable(FillInterest.java:110)
>         at org.eclipse.jetty.io
> .ChannelEndPoint$2.run(ChannelEndPoint.java:124)
>         at
> org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:122)
>         at
>
> org.eclipse.jetty.util.thread.strategy.ExecutingExecutionStrategy.invoke(ExecutingExecutionStrategy.java:58)
>         at
>
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:201)
>         at
>
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:133)
>         at
>
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
>         at
>
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
>         at java.lang.Thread.run(Thread.java:745)
> Caused by: javax.jms.JMSException: Error while attempting to add new
> Connection to the pool
>         at
>
> org.apache.activemq.jms.pool.PooledConnectionFactory.createJmsException(PooledConnectionFactory.java:266)
>         at
>
> org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:225)
>         at
>
> org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:204)
>         at
>
> org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
>         at
> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>         ... 49 more
> Caused by: javax.jms.JMSException: Could not connect to broker URL:
> tcp://localhost:61616. Reason: java.net.BindException: Address already in
> use: connect
>         at
>
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36)
>         at
>
> org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:374)
>         at
>
> org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:304)
>         at
>
> org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:244)
>         at
>
> org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:275)
>         at
>
> org.apache.activemq.jms.pool.PooledConnectionFactory$1.makeObject(PooledConnectionFactory.java:95)
>         at
>
> org.apache.activemq.jms.pool.PooledConnectionFactory$1.makeObject(PooledConnectionFactory.java:92)
>         at
>
> org.apache.commons.pool2.impl.GenericKeyedObjectPool.create(GenericKeyedObjectPool.java:1041)
>         at
>
> org.apache.commons.pool2.impl.GenericKeyedObjectPool.addObject(GenericKeyedObjectPool.java:1221)
>         at
>
> org.apache.activemq.jms.pool.PooledConnectionFactory.createConnection(PooledConnectionFactory.java:221)
>         ... 52 more
> Caused by: java.net.BindException: Address already in use: connect
>         at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
>         at
> java.net
> .DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
>         at
> java.net
> .AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
>         at
> java.net
> .AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
>         at
> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
>         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
>         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
>         at java.net.Socket.connect(Socket.java:589)
>         at
>
> org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:525)
>         at
>
> org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:488)
>         at
> org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55)
>         at
>
> org.apache.activemq.transport.AbstractInactivityMonitor.start(AbstractInactivityMonitor.java:169)
>         at
>
> org.apache.activemq.transport.InactivityMonitor.start(InactivityMonitor.java:52)
>         at
>
> org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64)
>         at
>
> org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72)
>         at
>
> org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64)
>         at
>
> org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:64)
>         at
>
> org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:354)
>         ... 60 more
>
>
> ActiveMQ config:
>
>     <bean id="pooledConnectionFactory"
>           class="org.apache.activemq.pool.PooledConnectionFactory"
> init-method="start" destroy-method="stop">
>         <property name="maxConnections" value="25" />
>         <property name="connectionFactory">
>             <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>                 <property name="brokerURL" value="tcp://localhost:61616" />
>             </bean>
>         </property>
>
>     </bean>
>
>     <bean id="jmsConfig"
>           class="org.apache.camel.component.jms.JmsConfiguration">
>         <property name="connectionFactory" ref="pooledConnectionFactory"/>
>         <property name="concurrentConsumers" value="10"/>
>     </bean>
>
>     <bean id="activemq"
>           class="org.apache.activemq.camel.component.ActiveMQComponent">
>         <property name="configuration" ref="jmsConfig"/>
>     </bean>
>
>
> Call to the activeMQ endpoint (using Camel and queue name set in Camel
> header CamelJmsDestinationName):
>
> .to('activemq:queue:dummy?exchangePattern=InOut&requestTimeout=35000')
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>