Environment
NetIQ Access Manager 3.x
NetIQ Access Manager 4.x
Situation
ERROR BrokerService - Failed to resolve localhost
/var/log/activemq/activemq.stdout2 shows:
ERROR BrokerService - Failed to start ActiveMQ JMS Message Broker. Reason: java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://127.0.0.1:61616 due to: java.net.UnknownHostException: *: *: Name or service not known
At console see the following exception when novell-activemq attempt to start:
org.apache.activemq.util.IdGenerator <clinit>
WARNING: could not generate unique stub
java.net.UnknownHostException: *: *: Name or service not known
...
Resolution
Ensure a host enty exists for the Access Gateway's primary IP Address and hostname.
Note: If Access Gateway Appliance, modify the /etc/hosts and then ensure that /etc/init.d/novell-activemq will start
If it starts ok, then ensure to modify the the hosts entry from within the AC Gui -> Devices -> Access Gateway -> Edit Cluster -> Hosts
Otherwise, as soon as any config change is made the hosts file will get over-written and will result with the same problem.
Note: If Access Gateway Appliance, modify the /etc/hosts and then ensure that /etc/init.d/novell-activemq will start
If it starts ok, then ensure to modify the the hosts entry from within the AC Gui -> Devices -> Access Gateway -> Edit Cluster -> Hosts
Otherwise, as soon as any config change is made the hosts file will get over-written and will result with the same problem.
Cause
Hosts enty doesn't exist, so when activemq fails with host not found exception.
Additional Information
In customer's case the AG's hostname was lag1anx
Their /etc/hosts file just had the following uncommented line:
127.0.0.1 localhost
The full excetion from the /var/log/activemq/activemq.stdout2 looked like this:
ACTIVEMQ_HOME: /opt/novell/activemq ACTIVEMQ_BASE: /opt/novell/activemq Loading message broker from: xbean:activemq.xml ERROR BrokerService - Failed to resolve localhost INFO BrokerService - Using Persistence Adapter: AMQPersistenceAdapter(/var/opt/novell/activemq) INFO BrokerService - ActiveMQ 5.1.0 JMS Message Broker (localhost) is starting INFO BrokerService - For help or more information please see: http://activemq.apache.org/ INFO AMQPersistenceAdapter - AMQStore starting using directory: /var/opt/novell/activemq INFO KahaStore - Kaha Store using data directory /var/opt/novell/activemq/kr-store/state INFO AMQPersistenceAdapter - Active data files: [] INFO KahaStore - Kaha Store using data directory /var/opt/novell/activemq/kr-store/data ERROR BrokerService - Failed to start ActiveMQ JMS Message Broker. Reason: java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://127.0.0.1:61616 due to: java.net.UnknownHostException: lag1anx: lag1anx: Name or service not known java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://127.0.0.1:61616 due to: java.net.UnknownHostException: lag1anx: lag1anx: Name or service not known at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27) at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1395) at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:1848) at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:1801) at org.apache.activemq.broker.BrokerService.start(BrokerService.java:455) at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:50) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1257) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:438) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:400) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:736) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369) at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64) at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52) at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:96) at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:52) at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71) at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54) at org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:111) at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:73) at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129) at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.activemq.console.Main.runTaskClass(Main.java:222) at org.apache.activemq.console.Main.main(Main.java:106) Caused by: java.io.IOException: Failed to bind to server socket: tcp://127.0.0.1:61616 due to: java.net.UnknownHostException: lag1anx: lag1anx: Name or service not known at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33) at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:124) at org.apache.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:60) at org.apache.activemq.transport.TransportFactory.bind(TransportFactory.java:123) at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:293) at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:135) at org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:98) at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1389) ... 35 more Caused by: java.net.UnknownHostException: lag1anx: lag1anx: Name or service not known
After adding
<ipaddress> lag1anx
or modifying the existing line to :
127.0.0.1 localhost lag1anx
novell-activemq started fine.