two applications using ActiveMQ: tomee attempts to start ActiveMQ twice

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

two applications using ActiveMQ: tomee attempts to start ActiveMQ twice

Emmanuel Touzery-2
Hello,

     we are running multiple applications on one TomEE+ instance, and
several of them make use of ActiveMQ.

     What happens then is that TomEE attempts to start ActiveMQ several
times. It results in errors in the log file as the extra startup
attempts fail due to the port already being used, but as far as we can
tell, despite the error, everything works fine. It seems as though TomEE
should just skip start ActiveMQ if it's already running. Should we
configure TomEE differently to avoid this issue?

     Regards,

Emmanuel

PS: the logs:

11-May-2017 09:14:49.531 INFO [main]
org.apache.openejb.resource.activemq.ActiveMQ5Factory.createBroker
ActiveMQ5Factory creating broker
11-May-2017 09:14:49.908 INFO [main]
org.apache.activemq.broker.BrokerService.<clinit> Loaded the Bouncy
Castle security provider.
11-May-2017 09:14:50.008 INFO [main]
org.apache.openejb.resource.activemq.ActiveMQ5Factory.createBroker Using
ActiveMQ startup timeout of 10000ms
11-May-2017 09:14:50.009 INFO [ActiveMQFactory start and checkpoint]
org.apache.openejb.resource.activemq.ActiveMQ5Factory$1.run Starting
ActiveMQ BrokerService
11-May-2017 09:14:50.335 INFO [ActiveMQFactory start and checkpoint]
org.apache.activemq.broker.BrokerService.doStartPersistenceAdapter Using
Persistence Adapter: MemoryPersistenceAdapter
11-May-2017 09:14:50.545 INFO [34]
org.apache.activemq.broker.jmx.ManagementContext$1.run JMX consoles can
connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
11-May-2017 09:14:50.611 INFO [ActiveMQFactory start and checkpoint]
org.apache.activemq.broker.BrokerService.doStartBroker Apache ActiveMQ
5.14.3 (localhost, ID:localhost-46298-1494494090400-0:1) is starting
11-May-2017 09:14:50.633 INFO [ActiveMQFactory start and checkpoint]
org.apache.activemq.transport.TransportServerThreadSupport.doStart
Listening for connections at: tcp://localhost:61616
11-May-2017 09:14:50.634 INFO [ActiveMQFactory start and checkpoint]
org.apache.activemq.broker.TransportConnector.start Connector
tcp://localhost:61616 started
11-May-2017 09:14:50.635 INFO [ActiveMQFactory start and checkpoint]
org.apache.activemq.broker.BrokerService.doStartBroker Apache ActiveMQ
5.14.3 (localhost, ID:localhost-46298-1494494090400-0:1) started
11-May-2017 09:14:50.635 INFO [ActiveMQFactory start and checkpoint]
org.apache.activemq.broker.BrokerService.doStartBroker For help or more
information please see: http://activemq.apache.org
11-May-2017 09:14:50.639 WARNING [ActiveMQFactory start and checkpoint]
org.apache.activemq.broker.BrokerService.checkUsageLimit Temporary Store
limit is 51200 mb (current store usage is 0 mb). The data directory:
/opt/app/apache-tomee-plus-7.0.3-LECIP/logs only has 10861 mb of usable
space. - resetting to maximum available disk space: 10861 mb
11-May-2017 09:14:50.707 INFO [32]
org.apache.openejb.resource.activemq.ActiveMQ5Factory$1.run Starting
ActiveMQ checkpoint
11-May-2017 09:14:50.708 INFO [main]
org.apache.openejb.resource.activemq.ActiveMQ5Factory.createBroker
ActiveMQ broker started

     And then later in the startup sequence:

11-May-2017 09:14:59.014 INFO [localhost-startStop-1]
org.apache.openejb.resource.activemq.ActiveMQ5Factory.createBroker
ActiveMQ5Factory creating broker
11-May-2017 09:14:59.017 SEVERE [localhost-startStop-1]
org.apache.openejb.resource.activemq.ActiveMQResourceAdapter.createInternalBroker
Failed to start ActiveMQ
  java.lang.Exception:
ActiveMQFactory.createBroker.InvocationTargetException
     at
org.apache.openejb.resource.activemq.ActiveMQFactory.createBroker(ActiveMQFactory.java:128)
     at
org.apache.openejb.resource.activemq.ActiveMQResourceAdapter.createInternalBroker(ActiveMQResourceAdapter.java:150)
     at
org.apache.openejb.resource.activemq.ActiveMQResourceAdapter.start(ActiveMQResourceAdapter.java:140)
     at
org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3051)
     at
org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2803)
     at
org.apache.openejb.config.ConfigurationFactory.doInstall(ConfigurationFactory.java:466)
     at
org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:459)
     at
org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2194)
     at
org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:2043)
     at
org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1978)
     at
org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2181)
     at
org.apache.openejb.config.AutoConfig.autoCreateResource(AutoConfig.java:2068)
     at
org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:2056)
     at
org.apache.openejb.config.AutoConfig.getResourceId(AutoConfig.java:1978)
     at
org.apache.openejb.config.AutoConfig.processResourceRef(AutoConfig.java:1218)
     at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:873)
     at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:201)
     at
org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:420)
     at
org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:1037)
     at
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1276)
     at
org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1124)
     at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
     at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
     at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5087)
     at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
     at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
     at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
     at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
     at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:596)
     at
org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1805)
     at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
     at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
     at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
     at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:498)
     at
org.apache.openejb.resource.activemq.ActiveMQFactory.createBroker(ActiveMQFactory.java:122)
     ... 34 more
Caused by: java.io.IOException: Failed to bind to server socket:
tcp://localhost:61616 due to: java.net.BindException: Address already in
use (Bind failed)
     at
org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:34)
     at
org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:143)
     at
org.apache.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:62)
     at
org.apache.activemq.transport.TransportFactorySupport.bind(TransportFactorySupport.java:40)
     at
org.apache.activemq.broker.BrokerService.createTransportConnector(BrokerService.java:2477)
     at
org.apache.activemq.broker.BrokerService.addConnector(BrokerService.java:337)
     at
org.apache.openejb.resource.activemq.ActiveMQ5Factory.newDefaultBroker(ActiveMQ5Factory.java:289)
     at
org.apache.openejb.resource.activemq.ActiveMQ5Factory.createBroker(ActiveMQ5Factory.java:99)
     ... 39 more
Caused by: java.net.BindException: Address already in use (Bind failed)
     at java.net.PlainSocketImpl.socketBind(Native Method)
     at
java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
     at java.net.ServerSocket.bind(ServerSocket.java:375)
     at java.net.ServerSocket.<init>(ServerSocket.java:237)
     at
javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
     at
org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:140)
     ... 45 more