p.nettyException - Handling TooLongFrameException

2019-08-09 04:22发布

问题:

I'm trying to get started with the Play! framework, but when I attempt to start the server with activator run, I get the error below. I'm using activator 1.2.12.

[warn] p.nettyException - Handling TooLongFrameException
org.jboss.netty.handler.codec.frame.TooLongFrameException: HTTP header is larger than 8192 bytes.
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeader(HttpMessageDecoder.java:624) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:531) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:195) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:102) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500) ~[netty-3.9.3.Final.jar:na]
[error] p.nettyException - Exception caught in Netty
java.lang.IllegalArgumentException: Header name cannot contain the following prohibited characters: =,;: \t\r\n\v\f 
    at org.jboss.netty.handler.codec.http.HttpHeaders.valideHeaderNameChar(HttpHeaders.java:1040) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.DefaultHttpHeaders.hash(DefaultHttpHeaders.java:63) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.DefaultHttpHeaders.add(DefaultHttpHeaders.java:140) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:536) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:195) ~[netty-3.9.3.Final.jar:na]
[warn] p.nettyException - Handling TooLongFrameException
org.jboss.netty.handler.codec.frame.TooLongFrameException: HTTP header is larger than 8192 bytes.
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeader(HttpMessageDecoder.java:624) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:531) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:195) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:102) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500) ~[netty-3.9.3.Final.jar:na]
[error] p.nettyException - Exception caught in Netty
java.lang.IllegalArgumentException: Header name cannot contain the following prohibited characters: =,;: \t\r\n\v\f 
    at org.jboss.netty.handler.codec.http.HttpHeaders.valideHeaderNameChar(HttpHeaders.java:1040) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.DefaultHttpHeaders.hash(DefaultHttpHeaders.java:63) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.DefaultHttpHeaders.add(DefaultHttpHeaders.java:140) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:536) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:195) ~[netty-3.9.3.Final.jar:na]
[warn] p.nettyException - Handling TooLongFrameException
org.jboss.netty.handler.codec.frame.TooLongFrameException: HTTP header is larger than 8192 bytes.
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeader(HttpMessageDecoder.java:624) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:531) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:195) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:102) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500) ~[netty-3.9.3.Final.jar:na]
[error] p.nettyException - Exception caught in Netty
java.lang.IllegalArgumentException: Header name cannot contain the following prohibited characters: =,;: \t\r\n\v\f 
    at org.jboss.netty.handler.codec.http.HttpHeaders.valideHeaderNameChar(HttpHeaders.java:1040) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.DefaultHttpHeaders.hash(DefaultHttpHeaders.java:63) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.DefaultHttpHeaders.add(DefaultHttpHeaders.java:140) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeaders(HttpMessageDecoder.java:536) ~[netty-3.9.3.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:195) ~[netty-3.9.3.Final.jar:na]

Anyone familiar with this error?

I've noticed that this is occurring with all of the activator seeds. Without editing any files after running activator new. I've also updated to the most recent version of activator and scala, with no luck.

回答1:

Request Header size is more than 8192 bytes. You can set it by adding -Dhttp.netty.maxHeaderSize:xx (xx = size required based on your request header size) in system properties while running the application.

Or

Try to reduce the header size. Check the headers you are sending in the request.

Also see Production Configuration to configure that value in your application.conf.