Recently I had the same issue.
akka.remote.netty.tcp.port was set to 0 but actor system was trying to bind 
on 2552.
The problem was that actor system was lazy val in my specs but config it 
was using wasnt, like following:

trait CommonSpec extends TestKitBase {
  val config: Config = mkConfig

  implicit lazy val system: ActorSystem = ActorSystem("api", config)
}

This mistake made system initialize twice: with the default config values 
(config val at the system initialization moment was null)  and again with 
right config value.

On Monday, November 3, 2014 1:31:22 PM UTC+3, Suresh Kumar wrote:
>
>  
> Hi,
>  
> I have a bunch of unit tests for my actor system (akka 2.3) which is in a 
> clustor. The below error comes randomly in some of the tests during 
> build.(which works fine in eclipse if we run one by one). I have put 
> parallelExecution in Test := false in build.scala, but still the error 
> persists.
>  
> My conf looks like
>  
> akka {        
>   loggers = ["akka.testkit.TestEventListener"]
>   loglevel = "DEBUG"        
>   stdout-loglevel = "DEBUG"
>         
>   actor {
>     debug {
>       receive = on
> #      lifecycle = on
>       autoreceive = on
>     }
>       remote {
>   netty.tcp {
>   hostname = "127.0.0.1"
>   port = 0  
>   }
>  }
>   }    
>  
> sbt.ForkMain$ForkError: Failed to bind to: /127.0.1.1:2552
>  at 
> org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
>  at 
> akka.remote.transport.netty.NettyTransport$$anonfun$listen$1.apply(NettyTransport.scala:392)
>  at 
> akka.remote.transport.netty.NettyTransport$$anonfun$listen$1.apply(NettyTransport.scala:389)
>  at scala.util.Success$$anonfun$map$1.apply(Try.scala:206)
>  at scala.util.Try$.apply(Try.scala:161)
>  at scala.util.Success.map(Try.scala:206)
>  at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
>  at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
>  at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
>  at 
> akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
>  at 
> akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
>  at 
> akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
>  at 
> akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
>  at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
>  at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
>  at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
>  at 
> akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
>  at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
>  at 
> scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
>  at 
> scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
>  at 
> scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
> Caused by: sbt.ForkMain$ForkError: Address already in use
>  at sun.nio.ch.Net.bind0(Native Method)
>  at sun.nio.ch.Net.bind(Net.java:444)
>  at sun.nio.ch.Net.bind(Net.java:436)
>  at 
> sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
>  
>  
> Thanks in advance,
> Suresh
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to