Android上的Akka Remote:尝试在空对象引用上调用虚方法'java.lang.Object java.lang.StackTraceElement [] .clone()'

时间:2016-06-05 12:22:14

标签: android akka

我正在开发一个简单的Android应用,它应该连接到同一本地网络中的服务器。服务器和应用程序都运行Akka Remote。

确实可以在Android应用程序中启动ActorSystem,但是第一次向服务器发出请求时会出现下面列出的NullPointerException。

如果我在主线程或AsyncTask中启动ActorSystem并且有趣的是,模拟器上不存在问题,而只是在“真实网络”中的物理设备上。

有谁知道这个问题的原因是什么?

06-05 14:07:35.074 4746-5303/ch.fhnw.ws6.chat I/System.out: [INFO] [06/05/2016 14:07:35.073] [AsyncTask #7] [Remoting] Starting remoting
06-05 14:07:35.544 4746-5303/ch.fhnw.ws6.chat I/System.out: [INFO] [06/05/2016 14:07:35.543] [AsyncTask #7] [Remoting] Remoting started; listening on addresses :[akka.tcp://clientActorSystem@192.168.254.104:12345]
06-05 14:07:35.547 4746-5303/ch.fhnw.ws6.chat I/System.out: [INFO] [06/05/2016 14:07:35.546] [AsyncTask #7] [Remoting] Remoting now listens on addresses: [akka.tcp://clientActorSystem@192.168.254.104:12345]
06-05 14:07:35.589 4746-5235/ch.fhnw.ws6.chat D/login-tag: Send login request... 192.168.254.105:14711
06-05 14:07:35.821 4746-5305/ch.fhnw.ws6.chat I/System.out: [WARN] [06/05/2016 14:07:35.819] [clientActorSystem-akka.remote.default-remote-dispatcher-5] [akka.tcp://clientActorSystem@192.168.254.104:12345/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FChatServerSystem%40192.168.254.105%3A14711-0] Association with remote system [akka.tcp://ChatServerSystem@192.168.254.105:14711] has failed, address is now gated for [5000] ms. Reason: [Attempt to invoke virtual method 'java.lang.Object java.lang.StackTraceElement[].clone()' on a null object reference] 
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out: [ERROR] [06/05/2016 14:07:35.832] [clientActorSystem-akka.remote.default-remote-dispatcher-6] [Remoting] Attempt to invoke virtual method 'java.lang.Object java.lang.StackTraceElement[].clone()' on a null object reference
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.StackTraceElement[].clone()' on a null object reference
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.OnlyCauseStackTrace$class.fillInStackTrace(AkkaException.scala:27)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.remote.EndpointException.fillInStackTrace(Endpoint.scala:113)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at java.lang.Throwable.<init>(Throwable.java:106)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at java.lang.Exception.<init>(Exception.java:60)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at java.lang.RuntimeException.<init>(RuntimeException.java:59)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.AkkaException.<init>(AkkaException.scala:15)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.remote.EndpointException.<init>(Endpoint.scala:113)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.remote.EndpointAssociationException.<init>(Endpoint.scala:153)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.remote.EndpointWriter$$anonfun$initializing$1.applyOrElse(Endpoint.scala:596)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.actor.Actor$class.aroundReceive(Actor.scala:467)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.remote.EndpointActor.aroundReceive(Endpoint.scala:437)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.actor.ActorCell.invoke(ActorCell.scala:487)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.dispatch.Mailbox.run(Mailbox.scala:220)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
06-05 14:07:35.838 4746-5305/ch.fhnw.ws6.chat I/System.out:     at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
06-05 14:07:35.839 4746-5305/ch.fhnw.ws6.chat I/System.out:     at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

0 个答案:

没有答案