HornetQでクラスタ構成にしたとき、Failed to connect to server localhost/127.0.0.1:1099が出るときの対処法
config/stand-alone/clustered/jndi.properties
に
java.naming.provider.url=jnp://localhost:1099
の行を追加すると、下記のようなエラーが出る。
エラー内容
22:18:20,114 INFO [org.hornetq.integration.bootstrap] HQ101000: Starting HornetQ Server 22:18:20,949 WARN [org.hornetq.core.server] HQ222018: AIO was not located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal 22:18:21,045 INFO [org.hornetq.core.server] HQ221000: live server is starting with configuration HornetQ Configuration (clustered=true,backup=false,sharedStore=true,journalDirectory=../data/journal,bindingsDirectory=../data/bindings,largeMessagesDirectory=../data/large-messages,pagingDirectory=../data/paging) 22:18:21,048 INFO [org.hornetq.core.server] HQ221006: Waiting to obtain live lock 22:18:21,076 WARN [org.jnp.server.NamingBeanImpl] Context.PROVIDER_URL in server jndi.properties, url=localhost:1099 22:18:27,100 WARN [org.hornetq.core.server] HQ222165: Error starting naming server: javax.naming.CommunicationException: Could not obtain connection to any of these urls: jnp://localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1763) [jboss-mc.jar:] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:693) [jboss-mc.jar:] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686) [jboss-mc.jar:] at javax.naming.InitialContext.lookup(Unknown Source) [rt.jar:1.8.0_131] at org.jnp.server.NamingBeanImpl.start(NamingBeanImpl.java:183) [jboss-mc.jar:] at org.hornetq.jms.server.impl.StandaloneNamingServer$ServerActivateCallback.preActivate(StandaloneNamingServer.java:121) [hornetq-jms-server.jar:] at org.hornetq.core.server.impl.HornetQServerImpl.callPreActiveCallbacks(HornetQServerImpl.java:1436) [hornetq-server.jar:] at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart1(HornetQServerImpl.java:1506) [hornetq-server.jar:] at org.hornetq.core.server.impl.HornetQServerImpl.access$1100(HornetQServerImpl.java:172) [hornetq-server.jar:] at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation.run(HornetQServerImpl.java:2144) [hornetq-server.jar:] at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:432) [hornetq-server.jar:] at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:483) [hornetq-jms-server.jar:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.8.0_131] at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.8.0_131] at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59) [jboss-mc.jar:] at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150) [jboss-mc.jar:] at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [jboss-mc.jar:] at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241) [jboss-mc.jar:] at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-mc.jar:] at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109) [jboss-mc.jar:] at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70) [jboss-mc.jar:] at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221) [jboss-mc.jar:] at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-mc.jar:] at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-mc.jar:] at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-mc.jar:] at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-mc.jar:] at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-mc.jar:] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) [jboss-mc.jar:] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631) [jboss-mc.jar:] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) [jboss-mc.jar:] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) [jboss-mc.jar:] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) [jboss-mc.jar:] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774) [jboss-mc.jar:] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540) [jboss-mc.jar:] at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:319) [jboss-mc.jar:] at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:297) [jboss-mc.jar:] at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130) [jboss-mc.jar:] at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96) [jboss-mc.jar:] at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:236) [hornetq-bootstrap.jar:] at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:206) [hornetq-bootstrap.jar:] at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:154) [hornetq-bootstrap.jar:] at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83) [jboss-mc.jar:] at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:115) [hornetq-bootstrap.jar:] at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:69) [hornetq-bootstrap.jar:] Caused by: javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused: connect]] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:335) [jboss-mc.jar:] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1734) [jboss-mc.jar:] ... 45 more Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused: connect] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:305) [jboss-mc.jar:] ... 46 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) [rt.jar:1.8.0_131] at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) [rt.jar:1.8.0_131] at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) [rt.jar:1.8.0_131] at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) [rt.jar:1.8.0_131] at java.net.AbstractPlainSocketImpl.connect(Unknown Source) [rt.jar:1.8.0_131] at java.net.PlainSocketImpl.connect(Unknown Source) [rt.jar:1.8.0_131] at java.net.SocksSocketImpl.connect(Unknown Source) [rt.jar:1.8.0_131] at java.net.Socket.connect(Unknown Source) [rt.jar:1.8.0_131] at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:97) [jboss-mc.jar:] at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:82) [jboss-mc.jar:] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:301) [jboss-mc.jar:] ... 46 more 22:18:27,188 INFO [org.hornetq.core.server] HQ221013: Using NIO Journal 22:18:27,223 WARN [org.hornetq.core.server] HQ222007: Security risk! HornetQ is running with the default cluster admin user and default password. Please see the HornetQ user guide, cluster chapter, for instructions on how to change this. 22:18:27,338 INFO [org.hornetq.core.server] HQ221043: Adding protocol support CORE 22:18:27,342 INFO [org.hornetq.core.server] HQ221043: Adding protocol support AMQP 22:18:27,346 INFO [org.hornetq.core.server] HQ221043: Adding protocol support STOMP 22:18:27,446 INFO [org.hornetq.core.server] HQ221034: Waiting to obtain live lock 22:18:27,446 INFO [org.hornetq.core.server] HQ221035: Live Server Obtained live lock 22:18:34,226 INFO [org.hornetq.core.server] HQ221003: trying to deploy queue jms.queue.DLQ
原因
Standaloneサーバ内のjndiサーバが起動する前に、jndiクライアントとして接続しに行こうとするから?(原因不明)