[error] p.c.s.n.PlayRequestHandler - Exception caught in Netty java.lang.NoClassDefFoundError: Could not initialize class play.api.http.DefaultHttpErrorHandler$

1,272 views
Skip to first unread message

おうおう

unread,
Aug 3, 2016, 11:23:58 PM8/3/16
to play-framework
[error] p.c.s.n.PlayRequestHandler - Exception caught in Netty
java.lang.NoClassDefFoundError: Could not initialize class play.api.http.DefaultHttpErrorHandler$
        at play.core.server.Server$class.logExceptionAndGetResult$1(Server.scala:45)
        at play.core.server.Server$class.getHandlerFor(Server.scala:65)
        at play.core.server.NettyServer.getHandlerFor(NettyServer.scala:47)
        at play.core.server.netty.PlayRequestHandler.handle(PlayRequestHandler.scala:82)
        at play.core.server.netty.PlayRequestHandler.channelRead(PlayRequestHandler.scala:163)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
        at com.typesafe.netty.http.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:129)
        at com.typesafe.netty.http.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:96)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
[error] p.c.s.n.PlayRequestHandler - Exception caught in Netty
java.lang.NoClassDefFoundError: Could not initialize class play.api.http.DefaultHttpErrorHandler$
        at play.core.server.Server$class.logExceptionAndGetResult$1(Server.scala:45)
        at play.core.server.Server$class.getHandlerFor(Server.scala:65)
        at play.core.server.NettyServer.getHandlerFor(NettyServer.scala:47)
        at play.core.server.netty.PlayRequestHandler.handle(PlayRequestHandler.scala:82)
        at play.core.server.netty.PlayRequestHandler.channelRead(PlayRequestHandler.scala:163)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
        at com.typesafe.netty.http.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:129)
        at com.typesafe.netty.http.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:96)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)

what's wrong with this ,how to solve it。thanks

Igmar Palsenberg

unread,
Aug 8, 2016, 5:28:16 AM8/8/16
to play-framework
 
[error] p.c.s.n.PlayRequestHandler - Exception caught in Netty
java.lang.NoClassDefFoundError: Could not initialize class play.api.http.DefaultHttpErrorHandler$
        at play.core.server.Server$class.logExceptionAndGetResult$1(Server.scala:45)
        at play.core.server.Server$class.getHandlerFor(Server.scala:65)
        at play.core.server.NettyServer.getHandlerFor(NettyServer.scala:47)
        at play.core.server.netty.PlayRequestHandler.handle(PlayRequestHandler.scala:82)
        at play.core.server.netty.PlayRequestHandler.channelRead(PlayRequestHandler.scala:163)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
        at com.typesafe.netty.http.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:129)
        at com.typesafe.netty.http.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:96)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)

1) Do you have a play.http.requestHandler in your application.conf ? If yes, try disabling that
2) Do a sbt clean cleanFiles update compile

See if that helps.


Igmar 

Isaka Traore

unread,
Aug 9, 2016, 4:39:11 AM8/9/16
to play-framework
This is typically what happens if something at the lower level of your Play application is improperly configured. The first place I would look is in application.conf. Quite likely something isn't properly configured, causing the core request handler to fail to load. Yes, maybe the error could be more helpful, but that's a topic for another day. You want to fix this issue, first, right?

Try this:

1) Set aside (backup) the current version of application.conf in your app. Put it on your Desktop for example.
2) Replace it with a freshly created application.conf file (right after you've created an app, via activator for example)
3) Clean and rebuild your application. I usually run these SBT tasks in succession: clean, cleanFiles, compile or run
4) If you had a misconfiguration, then you should now get a better error message - this one should be gone.
5) If the previous step was a success, you can slowly examine your intended application.conf. My advice, comment everything you've added (above the default), then one by one, uncomment an item, run your app and test it, and repeat, until you find the culprit.

Good luck.
Reply all
Reply to author
Forward
0 new messages