Null Pointer exception while running Scheduler project implemented using Akka actors

I was able to compile my Scheduler project implemented using AKKA Actor framework. But when I run the project below is the error which I get while starting Netty server:

[info] Set current project to play-java (in build file:/C:/Play_Sample_R&D_Proje
cts/play-java-starter-example-2.5.x/)

--- (Running the application, auto-reloading is enabled) ---

java.lang.NullPointerException
        at io.netty.channel.group.DefaultChannelGroup.add(DefaultChannelGroup.ja
va:146)
        at play.core.server.NettyServer.bind(NettyServer.scala:140)
        at play.core.server.NettyServer.play$core$server$NettyServer$$bindChanne
l(NettyServer.scala:224)
        at play.core.server.NettyServer$$anonfun$1.apply(NettyServer.scala:216)
        at play.core.server.NettyServer$$anonfun$1.apply(NettyServer.scala:216)
        at scala.Option.map(Option.scala:146)
        at play.core.server.NettyServer.<init>(NettyServer.scala:216)
        at play.core.server.NettyServerProvider.createServer(NettyServer.scala:2
79)
        at play.core.server.NettyServerProvider.createServer(NettyServer.scala:2
78)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:235)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:65)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:64)
        at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala
:54)
        at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at play.runsupport.Reloader$.startDevMode(Reloader.scala:234)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.devModeServer$lzycompute$1(PlayRun.scala:74)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.play$sbt$run$PlayRun$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRu
n.scala:74)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:100)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:53)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) java.lang.reflect.InvocationTargetException
[error] Total time: 4 s, completed Apr 23, 2018 4:58:31 PM

Hello

Reading the stack I’d say that your instance of io.netty.channel.group.DefaultChannelGroup is null

It looks like this is the end result of running the run command on the play console, in “dev mode”, right?
There must be something not properly set in the play application…?

I would encourage you to get familiar reading the error stack trace to spot what is wrong.

All the best
Ivano

I re-categorized this as a Play question as I also think it is about the dev mode somehow.

@Ivano and @johanandren, Thanks much for your help. It’s related to my Play application and I was able to start the server now.

Great to hear. Would you mind sharing what was wrong, so that if anyone has the same problem in the future they can find the solution/explanation to what was wrong here?

1 Like

@ GopalaKrishna Devalla

what was wrong, so that if anyone has the same problem in the future they can find the solution/explanation to what was wrong here?