HomeIndex > FAQ > Admin questions > How to disable Geronimo services to avoid port conflicts
{scrollbar}

Running many Geronimo instances on the same machine can lead to port conflicts. You can assign new port numbers to services per Geronimo instance or disable them completely so they are not started up. Let's see what needs to be done in order to disable Geronimo services.

Let say you want to disable the ActiveMQ brokers. Their configuration in var/config/config.xml file is as follows (Geronimo 2.1-SNAPSHOT):

XMLsolidvar/config/config.xml <ns2:module name="org.apache.geronimo.configs/activemq-broker/2.1-SNAPSHOT/car"> <ns2:gbean name="ActiveMQ.tcp.default"> <ns2:attribute name="host">${ServerHostname}</ns2:attribute> <ns2:attribute name="port">${ActiveMQPort + PortOffset}</ns2:attribute> </ns2:gbean> <ns2:gbean name="ActiveMQ.stomp.default"> <ns2:attribute name="host">${ServerHostname}</ns2:attribute> <ns2:attribute name="port">${ActiveMQStompPort + PortOffset}</ns2:attribute> </ns2:gbean> </ns2:module>

When you run Geronimo these services (gbeans) are shown in the Listening on Ports section at Geronimo startup:

solid $ ./bin/geronimo.sh run Using GERONIMO_BASE: c:\geronimo Using GERONIMO_HOME: c:\geronimo Using GERONIMO_TMPDIR: c:\geronimo\var\temp Using JRE_HOME: c:\apps\java5\jre Booting Geronimo Kernel (in Java 1.5.0_14)... Starting Geronimo Application Server v2.1-SNAPSHOT ... Listening on Ports: 0 0.0.0.0 Derby Connector 1050 127.0.0.1 CORBA Naming Service 1099 0.0.0.0 RMI Naming 2001 127.0.0.1 OpenEJB ORB Adapter 4201 0.0.0.0 OpenEJB Daemon 6882 127.0.0.1 OpenEJB ORB Adapter 8009 0.0.0.0 Jetty Connector AJP13 8080 0.0.0.0 Jetty SelectChannel Connector HTTP 8443 0.0.0.0 Jetty SelectChannel Connector HTTPS 9999 0.0.0.0 JMX Remoting Connector 61613 0.0.0.0 ActiveMQ Transport Connector 61616 0.0.0.0 ActiveMQ Transport Connector

The services in question are two ActiveMQ Transport Connectors listening to 61613 and 61616 ports.

To disable these two ActiveMQ Transport Connectors you need to disable ActiveMQ.tcp.default and ActiveMQ.stomp.default gbeans. Edit var/config/config.xml and add the attribute load="false" in their gbean definitions. Note the load="false" attributes of the ns2:gbean elements.

XMLsolidvar/config/config.xml <ns2:module name="org.apache.geronimo.configs/activemq-broker/2.1-SNAPSHOT/car"> <ns2:gbean name="ActiveMQ.tcp.default" load="false"> <ns2:attribute name="host">${ServerHostname}</ns2:attribute> <ns2:attribute name="port">${ActiveMQPort + PortOffset}</ns2:attribute> </ns2:gbean> <ns2:gbean name="ActiveMQ.stomp.default" load="false"> <ns2:attribute name="host">${ServerHostname}</ns2:attribute> <ns2:attribute name="port">${ActiveMQStompPort + PortOffset}</ns2:attribute> </ns2:gbean> </ns2:module>

After the change, when you start up Geronimo it will show you that the gbeans are indeed not started.

solid $ ./bin/geronimo.sh run Using GERONIMO_BASE: c:\geronimo Using GERONIMO_HOME: c:\geronimo Using GERONIMO_TMPDIR: c:\geronimo\var\temp Using JRE_HOME: c:\apps\java5\jre Booting Geronimo Kernel (in Java 1.5.0_14)... Starting Geronimo Application Server v2.1-SNAPSHOT ... Listening on Ports: 0 0.0.0.0 Derby Connector 1050 127.0.0.1 CORBA Naming Service 1099 0.0.0.0 RMI Naming 2001 127.0.0.1 OpenEJB ORB Adapter 4201 0.0.0.0 OpenEJB Daemon 6882 127.0.0.1 OpenEJB ORB Adapter 8009 0.0.0.0 Jetty Connector AJP13 8080 0.0.0.0 Jetty SelectChannel Connector HTTP 8443 0.0.0.0 Jetty SelectChannel Connector HTTPS 9999 0.0.0.0 JMX Remoting Connector

You do need to be very careful with disabling Geronimo services as some other services can still rely on them and as far as the ActiveMQ services go the following exception might be thrown:

solidjavax.resource.ResourceException: Could not create connection 08:56:47,046 ERROR [MCFConnectionInterceptor] Error occurred creating ManagedConnection for org.apache.ger onimo.connector.outbound.ConnectionInfo@da9a9 javax.resource.ResourceException: Could not create connection. at org.apache.activemq.ra.ActiveMQManagedConnectionFactory.createManagedConnection(ActiveMQManagedConnectionFactory.java:112) at org.apache.geronimo.connector.outbound.MCFConnectionInterceptor.getConnection(MCFConnectionInterceptor.java:48) at org.apache.geronimo.connector.outbound.XAResourceInsertionInterceptor.getConnection(XAResourceInsertionInterceptor.java:41) at org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor.internalGetConnection(SinglePoolConnectionInterceptor.java:67) at org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInterceptor.getConnection(AbstractSinglePoolConnectionInterceptor.java:78) at org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getConnection(TransactionEnlistingInterceptor.java:46) at org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConnection(TransactionCachingInterceptor.java:96) at org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection(TCCLInterceptor.java:39) at org.apache.geronimo.connector.outbound.AbstractConnectionManager.doRecovery(AbstractConnectionManager.java:65) at org.apache.geronimo.connector.outbound.AbstractConnectionManager$$FastClassByCGLIB$$80012030.invoke(<generated>) at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53) at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38) at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124) at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:830) at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57) at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35) at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96) at org.apache.geronimo.connector.outbound.ConnectionManagerContainer$$EnhancerByCGLIB$$714723c.doRecovery(<generated>) at org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper.doStart(ManagedConnectionFactoryWrapper.java:165) at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:996) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102) at org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:539) at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111) at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146) at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44) at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:254) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:294) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124) at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:553) at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379) at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:448) at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:187) at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:530) at org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>) at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53) at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38) at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124) at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:830) at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57) at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35) at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96) at org.apache.geronimo.kernel.config.EditableConfigurationManager$$EnhancerByCGLIB$$5aad2a42.startConfiguration(<generated>) at org.apache.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java:156) at org.apache.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:78) at org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.main(MainConfigurationBootstrapper.java:45) at org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:67) at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:30) Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://0.0.0.0:61616. Reason: java.net.ConnectException: Connection timed out: connect at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:33) at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:280) at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:168) at org.apache.activemq.ra.ActiveMQResourceAdapter.makeConnection(ActiveMQResourceAdapter.java:108) at org.apache.activemq.ra.ActiveMQResourceAdapter.makeConnection(ActiveMQResourceAdapter.java:102) at org.apache.activemq.ra.ActiveMQManagedConnectionFactory.createManagedConnection(ActiveMQManagedConnectionFactory.java:109) ... 50 more Caused by: java.net.ConnectException: Connection timed out: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:193) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:520) at org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:335) at org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:303) at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:49) at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:54) at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:54) at org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:66) at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:54) at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:54) at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:265) ... 54 more 08:56:47,046 ERROR [RecoveryController] javax.transaction.SystemException: Could not obtain recovery XAResource for managedConnectionFactory org.apache.activemq.ra.ActiveMQManagedConnec tionFactory@450c8896