Title: Actor creation error in akka
Tags: scala;akka
Question: trying to create an actor in akka and call its receive function. I keep getting this error.
[ERROR] [10/26/2013 18:53:29.313] [messagespreading-akka.actor.default-dispatcher-4] [akka://messagespreading/user/$a] error while processing Create(-1187846526)
70ec3d6a-184d-403c-8166-04aec76200c9akka.actor.ActorInitializationException: exception during ctaylor@example.org$.apply(Actor.scala:169)
at akka.actor.ActorCell.create(ActorCell.scala:496)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:351)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:256)
at akka.dispatch.Mailbox.run(Mailbox.scala:211)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:502)
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: java.lang.IllegalArgumentException: n must be ctaylor@example.org(Random.java:250)
at scala.util.Random.nextInt(Random.scala:65)
at NetworkBuilder.<init&gt;(pastry.scala:431)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:310)
at akka.util.Reflect$.instantiate(Reflect.scala:39)
at akka.actor.FromClassCreator.apply(Props.scala:187)
at akka.actor.FromClassCreator.apply(Props.scala:186)
at akka.actor.ActorCell.newActor(ActorCell.scala:461)
at akka.actor.ActorCell.create(ActorCell.scala:479)
... 8 more
CODE TO CREATE AND CALL ACTOR RECEIVE.
val system = ActorSystem("messagespreading")
var NetworkBuilderObj:ActorRef= system.actorOf(Props[NetworkBuilder])
NetworkBuilderObj ! test
Comment: What does the code for the `NetworkBuilder` Actor look like? The Exception is being thrown from the `NetworkBuilder` constructor when it calls `Random.nextInt` which requires a positive Int as an argument

Here is the accepted answer: When you get an exception occurring in third-party code, you need to look to see if there is a Caused by. In this case it says
Caused by: java.lang.IllegalArgumentException: n must be ctaylor@example.org(Random.java:250)
at scala.util.Random.nextInt(Random.scala:65)
at NetworkBuilder.(pastry.scala:431)
so there is the error - it has nothing to do with the code you posted per se.
Comment for this answer: Hi, can you tell me how can I look for 8 more lines in caused by sections which is currently not shown and do I have read these from bottom up or top down in terms of my code execution at run time?
Comment for this answer: What do you mean? It's right there above, you pasted it! As for how to read a stack trace, time in a stack trace flows from bottom to top.
Comment for this answer: Ah, maybe you are encountering the Play framework's stack trace truncation or something like that. Just look in the log file - it might be called `log/application.log`.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:10/26/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<scala><akka>', 'Title': 'Actor creation error in akka', 'ViewCount': 4846, 'id': 19612803, 'user_AboutMe': '<p>Professional Software Programmer currently working on the Java based backend stack.</p>\n', 'user_AccountId': 1108189.0, 'user_DisplayName': 'java_doctor_101', 'user_Reputation': 3180.0, 'user_Views': 488.0, 'user_id': 1099142.0}}