riak-scala-client
riak-scala-client copied to clipboard
Couldn't connect to localhost/127.0.0.1:8098
I'm trying to run a test on the example project. In RiakAlbumRepository.scala I replaced the server's host to one that I have Riak running on:
private val albums = RiakClient(context.system, "riak1.local", 8098).bucket("albums")
But when Id do sbt test I get the following exception:
[error] ConnectException: Couldn't connect to localhost/127.0.0.1:8098 (IOClientConnection.scala:73)
[error] spray.io.IOClientConnection$class.cantConnect(IOClientConnection.scala:73)
[error] spray.can.client.HttpClientConnection.cantConnect(HttpClientConnection.scala:28)
[error] spray.io.IOClientConnection$$anonfun$connecting$1.applyOrElse(IOClientConnection.scala:60)
[error] akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
[error] akka.actor.ActorCell.invoke(ActorCell.scala:386)
[error] akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
[error] akka.dispatch.Mailbox.run(Mailbox.scala:212)
[error] akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506)
[error] sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
[error] sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692)
[error] spray.io.IOBridge.connect(IOBridge.scala:341)
[error] spray.io.IOBridge.select(IOBridge.scala:247)
[error] spray.io.IOBridge$$anonfun$receive$1.apply(IOBridge.scala:75)
[error] spray.io.IOBridge$$anonfun$receive$1.apply(IOBridge.scala:73)
[error] akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
[error] akka.actor.ActorCell.invoke(ActorCell.scala:386)
[error] akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
[error] akka.dispatch.Mailbox.run(Mailbox.scala:212)
[error] Connection refused
[error] sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
[error] sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692)
[error] spray.io.IOBridge.connect(IOBridge.scala:341)
[error] spray.io.IOBridge.select(IOBridge.scala:247)
[error] spray.io.IOBridge$$anonfun$receive$1.apply(IOBridge.scala:75)
[error] spray.io.IOBridge$$anonfun$receive$1.apply(IOBridge.scala:73)
[error] akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
[error] akka.actor.ActorCell.invoke(ActorCell.scala:386)
[error] akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
[error] akka.dispatch.Mailbox.run(Mailbox.scala:212)
I do not have Riak running on localhost, but why this example tries to connect to it instead of specified host?
Hi Yuriy, sorry for the late reply but I was at Scaladays first and then on holiday.
My first impression would be that your local DNS (or the JVM implementation) resolves the "riak1.local" address to localhost for some reason. Have you tried using the IP address of the server instead of its name?